I am attempting to make a custom field on a sales order required. This custom field is only visible when OrderType is “NC”.
I am struggling with how to determine if the field is visible and if it is null or blank.
I have tried several different methods I have found from various sources. The code below is totally wrong… but is where I got to the point of asking for help…. This code is in my DAC extension.
protected void _(Events.RowPersisting<SOOrderExt> e)
{
var isVisible = SOOrder.orderType.IsEqual<ncOrder>;
if (BqlString.Field<usrNoChargeDept> == null && isVisible) {
throw new PXException(Messages.RequiredNCDept);
}
}
ncOrder is:
public class ncOrder : PX.Data.BQL.BqlString.Constant<ncOrder>
{
public ncOrder() : base("NC") { }
}
RequiredNCDept is a string in a file with other messages.
I attempted the solution here:
But ran into the issue of finding when the field is visible.
How can I make the field required only when visible?
Best answer by darylbowman
View original