I have custom fields on Sales order header. I want the fields active and mandatory only when order type is “XR”. Please assist how i can achieve that in Acumatica customization. The fields will be invisible if order type is any other
Conditionally make custom field on Sales Order mandatory when sales order type = "XR"
Best answer by Giri K
Create Extension graph for SOOrderEntry and add below code
public virtual void SOOrder_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected baseHandler)
{
Base.Document.View.RequestRefresh();
if (baseHandler != null)
baseHandler(cache, e);
var row = (SOOrder)e.Row;
if (row == null)
return;
if(row!=null)
{
//SOOrderExtension is Extension DAC for SO Header table
SOOrderExtension soExt = row.GetExtension<SOOrderExtension>();
if (row.OrderType=="XR")
{
PXUIFieldAttribute.SetVisible<SOOrderExtension.FieldName>(cache, null, true);
PXDefaultAttribute.SetPersistingCheck<SOOrderExtension.FieldName>(cache, null, PXPersistingCheck.NullOrBlank);
}
else
{
PXUIFieldAttribute.SetVisible<SOOrderExtension.FieldName>(cache, null, false);
PXDefaultAttribute.SetPersistingCheck<SOOrderExtension.FieldName>(cache, null, PXPersistingCheck.Nothing);
}
}
}
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.