Acumatica developers conference 2018 part 1

Hello everybody,

I want to summarize what I've seen and heard at latest Acumatica Developers conference.

First of all, I'd like to say that idea from Gabriel Michaud about using of attributes that can save plenty of time during development.

Part 1

Everyday trips and tricks (Magic attributes and BQL operands)

Lets start. For examle how to make a field required (or visible, or enabled) dynamically:

Traditional way (old version):

protected virtual void SOOrder_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
    SOOrder doc = e.Row as SOOrder;
    if (doc == null)
    {
           return;
    }

    if (doc.OrderType == "SO")
    {
          PXDefaultAttribute.SetPersistingCheck<SOOrder.customerOrderNbr>(cache, doc, PXPersistingCheck.NullOrBlank);
    }
    else
    {
        PXDefaultAttribute.SetPersistingCheck<SOOrder.customerOrderNbr>(cache, doc, PXPersistingCheck.Nothing);
    }
}

New way, using PXUIRequired attribute:

[PXMergeAttributes(Method = MergeMethod.Append)]
[PXDefault]
[PXUIRequired(typeof(Where<SOOrder.orderTypeEqual<sOOrderType>>))]
public string CustomerOrderNbr { getset; }

So now if you try to create Sales Order with Order Type "SO" and no enter Customer Order Acumatica show "Erorr, Customer Order Cannot be Empty"

 

Another attribute it is PXUIVisible:

[PXMergeAttributes(Method = MergeMethod.Append)]
[PXUIVisible(typeof(Where<Selector<SOOrder.customerIDCustomer.customerClassID>, Equal<keyCustomersClass>>))]
public string ProjectID { getset; }

So using this PXUIVisible we can make field visible or no; Also pat attention that Selector<> is powerfull and fast operand, becouse it get data from memory (cache);

 

Another attribute it is PXUIVerify:

[PXMergeAttributes(Method = MergeMethod.Append)]
[PXUIVerify(typeof(Where<SOOrder.requestDateGreater<SOOrder.orderDate>>), PXErrorLevel.Warning, "Request date should be greater than order date")]
public DateTime? RequestDate { getset; }

Use this way we can verify field. If we set PXErrorLevel.Erorr we can`t save data (if it is need);

 

Another attribute it is PXUIEnabled + PXDefault + PXFormula trigger:

[PXMergeAttributes(Method = MergeMethod.Append)]
[PXUIEnabled(typeof(Where<Selector<SOOrder.projectIDPMProject.nonProject>, Equal<True>>))]
[PXDefault(typeof(Search<PMTask.descriptionWhere<PMTask.projectIDEqual<Current<SOOrder.projectID>>>>),PersistingCheck = PXPersistingCheck.Nothing)]
[PXFormula(typeof(Default<SOOrder.projectID>))]
public  string OrderDesc { getset; }

Here Order description defaulted from Project and only editable for "X" (non-project);

PXFormula for force update of default value when ProjectID changes - replaces SetDefault;

 

Another attribute it is PXFormula + Selector:

[PXDBPriceCost]
[PXUIField(DisplayName = "MSRP", Enabled = false)]
[PXFormula(typeof(Selector<SOLine.inventoryIDInventoryItem.recPrice>))]
public decimal? UsrRecPrice { getset; }

Here I add new UsrRecPrice, and use Selector, this field will be refresh price when I will change inventoryId;

 

So use this attributes in yours projects;

Grid toolbar buttons in Acumatica

Hello everybody,

have you ever wondered, that SkinID property may regulate grid toolbar set of buttons? For me it was unknown untill today. Here it is list of id's and buttons according to T200:

  • Primary: Adds the Add, Delete, Fit to Screen, and Exportbuttons to the toolbar. This value is typically used for a grid on a simple edit page that consists of the single grid.
  • Details or DetailsInTab: Adds the Refresh, Add, Delete, Fit to Screen, and Export buttons to the toolbar. This value is typically used for a grid that displays the detail data on a master-detail page
  • Inquire: Adds the Refresh, Fit to Screen, and Export buttons to the toolbar. This value is typically used for grids on inquiry and processing pages
  • Selector: Adds the Refresh and Fit to Screen buttons to the toolbar
  • Attributes or ShortList: Hides the toolbar.

Now I know how to configure buttons of grid