Business Rules
Create the Order validation rule that requires Company ID and Company Name before the document can leave Validation Errors.
Create the Mandatory fields must not be empty validation rule for Order. The rule blocks approval until the document has both a company ID and a company name.
Prerequisites
Before you start, complete the Document Type. Confirm that header.company.id and header.company.name appear in field pickers.
Set the Settings tab
Enter the values from Rule settings.
Generate the rule
Open AI assistant and enter:
Check that every field selected in a field-path-list parameter with key
fieldsToCheckand label Mandatory Fields is present and is not null or an empty string. Return one validation error for each missing field.
Select Generate.

Review the generated rule
On Visual, confirm that the rule checks every field in Mandatory Fields for a present, non-empty value. On Code, confirm that fieldsToCheck is exposed as a Field path list parameter named Mandatory Fields. If the result differs, refine the prompt and regenerate before continuing.
Rule settings
Rule name
Mandatory fields must not be empty
Document type
Order
Applies to sub-types
Empty – the rule runs for every Order
Rule type
Validation
Execution order
10
Stop on validation failure
On
Active
On
Skippable
Off – a company is required before approval
Mandatory Fields
The Parameters tab lists the fields the rule checks. Paths are relative to the Order mixin.
header.company.id
ID
header.company.name
Name
The rule passes when both values are present and not empty. It fails if either is missing, null, or an empty string. Correct the company on the Form Layout, select Save, and run Revalidate.

Checkpoint
Return to the Order rules list. Confirm that Mandatory fields must not be empty is Active and Deployed. Do not continue while it is Draft or Not deployed.
Next, configure Approval and Rejection.
Last updated
Was this helpful?

