Creating Rules
This page provides step-by-step instructions for creating mandatory field rules in Simple Object Designer.
Accessing Rule Creation
Method 1: From Global Page Action List
- Open Tasks > Mark fields as mandatory on actions
- Find the page and action
- Click the Field Condition Count to edit rules
Method 2: From Page Customization
- Open Inspect > Pages
- Select and customize the page
- Click Mandatory Fields
- Select the action
- Click to manage conditions
Creating a Basic Rule
Step 1: Find the Action
- Open the Global Page Action List
- Filter by Page Name or browse the list
- Locate the action you want to protect
- Note the Action Name and Action Caption
Step 2: Open Conditions
- Click the Field Condition Count cell
- Or select the row and click Conditions action
- The Page Action Condition List opens
Step 3: Add a Condition
- Click New
- Configure the condition fields
Step 4: Select the Field
- Click the Field lookup
- Select the field to validate
- This field must be on the page's source table
Step 5: Choose the Operator
Select how to compare the field. Available operators:
| Operator | Use When |
|---|---|
= |
Field must match specific value |
<> |
Field must not match specific value (also: non-blank against '') |
> |
Numeric/date field must exceed threshold |
< |
Numeric/date field must be below threshold |
>= |
Numeric/date field must be at least the threshold |
<= |
Numeric/date field must be at most the threshold |
Contains |
Text field must contain a substring |
not Contains |
Text field must not contain a substring |
Text Length = |
Text length equals an integer |
Text Length <> |
Text length is not an integer |
Text Length > |
Text length is greater than an integer (use this for "must not be empty": > 0) |
Text Length < |
Text length is less than an integer |
Step 6: Set the Right-Side Expression
In the Expression (Right side) field:
- Enter the comparison value —
'open'for text,0for numbers,0Dfor blank date, etc. - You can also enter another field reference (
Rec."Order Date") to compare two fields. - For text Contains/not Contains and Text Length operators, the right side is a string or integer literal respectively.
Step 7: Test the Rule
- Publish your extension
- Open the page in Business Central
- Create or open a record
- Leave the mandatory field empty
- Click the protected action
- Verify the error appears
Rule Configuration Details
The Page Action Condition List
| Column | Description |
|---|---|
| Field Location | Main Table or Sub Table |
| Field No. | Validated field ID |
| Field Name | Field name |
| Operator | Comparison type (see operator list above) |
| Expression (Right side) | Literal value or expression to compare against |
| Error Message | Text shown when validation fails |
| Message Style | Error / Message / Confirm |
| Red asterisk field (Main table) | Optional UI hint field to mark with a red asterisk |
Operator Examples
Non-Blank Text
Field must contain a non-empty value.
Configuration:
- Field: Customer Name
- Operator: <>
- Expression (Right side): ''
Exact Match
Field must equal a specific value.
Configuration:
- Field: Status
- Operator: =
- Expression (Right side): 'Open'
Not Equal
Field must not equal the value.
Configuration:
- Field: Blocked
- Operator: <>
- Expression (Right side): Rec.Blocked::All
Greater Than
Numeric/date field must exceed a value.
Configuration:
- Field: Quantity
- Operator: >
- Expression (Right side): 0
Less Than or Equal
Numeric field must be at or below a threshold.
Configuration:
- Field: Discount %
- Operator: <=
- Expression (Right side): 50
Comparing to Another Field
The right-side expression can reference another field on the same record. No separate "Compare Field" picker — just type the field reference in Expression (Right side).
Example: Ensure Ship-to Date >= Order Date
- Field: Ship-to Date
- Operator: >=
- Expression (Right side): Rec."Order Date"
Multiple Rules Per Action
You can add multiple rules to one action:
AND Logic
All rules must pass for the action to proceed:
- Rule 1: Customer Name not blank
- Rule 2: Payment Terms not blank
- Rule 3: Amount > 0
If any rule fails, the action is blocked.
Adding Multiple Rules
- Open conditions for the action
- Add first rule
- Click New, add second rule
- Repeat for additional rules
Rules on Different Actions
The same field may need rules on different actions:
| Page | Action | Field | Rule |
|---|---|---|---|
| Sales Order | Release | Customer Name | <> '' |
| Sales Order | Post | Customer Name | <> '' |
| Sales Invoice | Post | Customer Name | <> '' |
Configure each action separately.
Rule Messages
When a rule fails, users see an error message indicating:
- Which field failed validation
- What value was expected
- Guidance to correct the issue
The Red Asterisk Indicator
The red asterisk shown next to a field is not condition-aware. It appears simply because the field is empty — it does not follow the conditional rules you configured.
Consequence: a field that is mandatory only under a certain condition still shows the red asterisk when that condition is not met and the field is legitimately allowed to be blank.
This is a display limitation, not a fault in your rule. Microsoft's standard product behaves the same way; the asterisk appears in many places where a blank value is perfectly acceptable.
Seeing the asterisk does not mean the conditional rule is misapplied. Enforcement — blocking the action — is what follows the condition. The asterisk is only a visual hint based on emptiness.
Testing Rules
Test Procedure
- Setup: Create a record missing the required value
- Action: Click the protected action
- Verify: Error message appears, action blocked
- Fix: Enter the required value
- Retry: Click action, should succeed
Test All Conditions
For multiple rules:
- Test each rule individually
- Test combinations of failures
- Verify all rules enforce correctly
Modifying Rules
Change an Existing Rule
- Open the conditions for the action
- Select the rule
- Modify the configuration
- Publish to apply changes
Delete a Rule
- Open the conditions for the action
- Select the rule
- Delete the row
- Publish to apply
Best Practices
Clear Field Selection
Choose fields that make sense to validate:
- Required business information
- Key identifiers
- Process-critical data
Appropriate Operations
Match operator to the business need:
- Use
<> ''for required text - Use
> 0for quantities - Use
=for specific status values - Use
Containsto enforce a required substring
Document Your Rules
Keep track of:
- Which actions have rules
- Why each rule exists
- Business justification
User Communication
Ensure users understand:
- Which fields are required
- When requirements apply
- How to satisfy rules