Simple Object Designer Documentation
Index

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

  1. Open Tasks > Mark fields as mandatory on actions
  2. Find the page and action
  3. Click the Field Condition Count to edit rules

Method 2: From Page Customization

  1. Open Inspect > Pages
  2. Select and customize the page
  3. Click Mandatory Fields
  4. Select the action
  5. Click to manage conditions

Creating a Basic Rule

Step 1: Find the Action

  1. Open the Global Page Action List
  2. Filter by Page Name or browse the list
  3. Locate the action you want to protect
  4. Note the Action Name and Action Caption

Step 2: Open Conditions

  1. Click the Field Condition Count cell
  2. Or select the row and click Conditions action
  3. The Page Action Condition List opens

Step 3: Add a Condition

  1. Click New
  2. Configure the condition fields

Step 4: Select the Field

  1. Click the Field lookup
  2. Select the field to validate
  3. 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:

  1. Enter the comparison value — 'open' for text, 0 for numbers, 0D for blank date, etc.
  2. You can also enter another field reference (Rec."Order Date") to compare two fields.
  3. For text Contains/not Contains and Text Length operators, the right side is a string or integer literal respectively.

Step 7: Test the Rule

  1. Publish your extension
  2. Open the page in Business Central
  3. Create or open a record
  4. Leave the mandatory field empty
  5. Click the protected action
  6. 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

  1. Open conditions for the action
  2. Add first rule
  3. Click New, add second rule
  4. 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

  1. Setup: Create a record missing the required value
  2. Action: Click the protected action
  3. Verify: Error message appears, action blocked
  4. Fix: Enter the required value
  5. 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

  1. Open the conditions for the action
  2. Select the rule
  3. Modify the configuration
  4. Publish to apply changes

Delete a Rule

  1. Open the conditions for the action
  2. Select the rule
  3. Delete the row
  4. 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 > 0 for quantities
  • Use = for specific status values
  • Use Contains to 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