Acumatica - Require Field in Setup Extension to be Not Null

194 Views Asked by At

I have a setup DAC extension that defines a default value for an SOOrder field. I need this field to not be null before the user can use the Sales Orders form. I know how to accomplish this with a custom setup DAC by using the PXPrimaryGraphAttribute on the DAC, but I'm not sure how to accomplish this with a DAC extension. I want to make the Sales Orders form look like this when my custom setup field is null:

enter image description here

Here is my DAC extension:

    public sealed class SOSetupExt : PXCacheExtension<SOSetup>
    {
        [SalesPerson(DisplayName = "Enabled Default Salesperson", Required = true)]
        public int? UsrEnabledDefaultSalesperson { get; set; }
        public abstract class usrEnabledDefaultSalesperson : PX.Data.BQL.BqlInt.Field<usrEnabledDefaultSalesperson> { }
    }
1

There are 1 best solutions below

8
Hugues Beauséjour On

Validate the field with a graph extension event handler and throw a PXSetupNotEnteredException exception:

throw new PXSetupNotEnteredException(ErrorMessages.SetupNotEntered, typeof(SOSetup), typeof(SOSetup).Name);