Mandatory Fields in CustTable

In CustTable the following three fields have the Mandatory property set to YES.

-Account Num

-Currency

-CustGroup

However creating a new record with only these values gives the errowarning;

Tax Group for Customer must be specified

Even though the Mandatory property for Tax Group is set to NO.

I have a suspicion this is something to do with the method ValidateWrite. But I can’t make sense of the code.

Also, I cannot understand why Dynamics AX would be set up so that some fields are made madatory thorugh via their properties and others using methods.

Look into validateWrite() again - everything there makes very good sense. The following code displays the warning:

if (ret && CustParameters::find().MandatoryTaxGroup && !this.TaxGroup)
{
    ret = checkFailed("@SYS113299");
}

The validation fails if TaxGroup is not filled AND parameters are set to require it. If you set the field as mandatory, it would have to be filled regardless of the parameter - that’s not what we want here.

Thanks