Set NotBlank property to false when No. Series TableRelation exists (AC0003)
When the ‘No. Series’ TableRelation is present on the table, assigning the primary key might occur after inserting the record, which could cause an error due to the NotBlank property.
Number series functionality in Business Central allows records to be inserted with an empty primary key value initially, with the actual value being assigned afterward through the number series logic. Setting NotBlank to true on such fields prevents this pattern from working correctly.
A code fix is available for this diagnostic.
Example
The following table has a ‘No. Series’ relationship but incorrectly sets NotBlank to true on the primary key:
table 50100 MyTable
{
fields
{
field(1; MyField; Code[20])
{
TableRelation = "No. Series";
NotBlank = true; // The NotBlank property should be set to false (or removed) if a TableRelation of 'No. Series' is present on the table. [AC0003]
}
}
keys
{
key(Key1; MyField) { }
}
}
To fix this, set NotBlank to false or remove the property:
table 50100 MyTable
{
fields
{
field(1; MyField; Code[20])
{
TableRelation = "No. Series";
NotBlank = false;
}
}
keys
{
key(Key1; MyField) { }
}
}
See also
- AC0002 - Single-field primary key requires the NotBlank property