Automatically Setting Field Values with Assign Actions
Introduction
Business processes frequently require automatic field updates based on transaction context, related data, or calculated results. Manual field updates create inconsistencies, consume staff time, and introduce errors when users forget critical field assignments or apply incorrect values.
Common scenarios requiring automatic field updates include status field management (setting priority based on customer type, updating inventory status based on stock levels), calculated field population (computing discounts from customer agreements, deriving payment terms from credit ratings), cross-table data synchronization (copying vendor information to purchase orders, replicating customer defaults to sales transactions), and timestamp management (recording last activity dates, tracking modification history).
QUALIA Rule Engine's Assign actions enable automatic field value assignment through static assignments (fixed values), field copying (values from current or related records), calculated formulas (mathematical operations, string manipulation), conditional logic (different values based on conditions), and aggregate-based assignments (values derived from SUM, COUNT, AVG calculations).
Assign action capabilities:
Static value assignment (text, numbers, dates, booleans)
Field-to-field copying within or across tables
Calculated formulas (arithmetic, string operations, date math)
Conditional assignments using IF statements
Aggregate-based values from related records
Multi-field coordinated updates
Part 1: Static Value Assignments
Assigning Fixed Values
Static value assignments set fields to predetermined values when conditions are met, useful for status management, default values, and classification.
Validation Set: Sales Order - Priority Assignment - OnInsert
Rule 1: Set High Priority for VIP CustomersTable: Sales Header (36)
Source References:
1. Customer (18)
Link via: [36:2] = [18:1]
Condition:
[18:CustomVIPStatus]
Action - Assign:
Target Field: [36:CustomPriority]
Result: When sales order created for VIP customer, Priority field automatically set to "High" without user intervention.
Placeholders Used in This Example:
[36:2] - Sales Header (Table 36): Sell-to Customer No. (Field 2) - Links order to customer record
[18:1] - Customer (Table 18): No. (Field 1) - Customer number for linking
[18:CustomVIPStatus] - Customer (Table 18): Custom VIP Status field - Boolean flag indicating VIP customer
[36:CustomPriority] - Sales Header (Table 36): Custom Priority field - Target field for automatic assignment
Fixed value: 'High' - Static text value assigned to priority field
Boolean Field Assignment
Rule 2: Flag Rush Orders Based on Requested DateCondition:
[36:CustomRequestedShipDate] < [T]
Action - Assign:
Target Field: [36:CustomRushOrder]
Result: Orders requiring shipment within 3 days automatically flagged as rush orders.
Date Field Assignment
Rule 3: Set Review Date Based on Order AmountCondition:
[36:109]
Action - Assign:
Target Field: [36:CustomReviewDate]
Formula: [T]
Result: High-value orders automatically assigned review date one week out.
Part 2: Field-to-Field Copying
Copying Within Same Record
Assign actions can copy values from one field to another within the same record for data propagation or backup purposes.
Validation Set: Customer - Data Synchronization - OnModify
Rule 1: Backup Original Credit LimitTable: Customer (18)
Condition:
{18:59} <> [18:59]
Action - Assign:
Target Field: [18:CustomPreviousCreditLimit]
Result: Maintains history of previous credit limit before changes applied.
Copying Across Tables
Rule 2: Copy Customer Payment Terms to OrderValidation Set: Sales Order - Payment Terms Copy - OnInsert
Source References:
1. Customer (18)
Link via: [36:2] = [18:1]Condition:
[36:64]
Action - Assign:
Target Field: [36:64]
Formula: [18:27]
// Copy customer default payment terms to order
Where:
[18:27] = Payment Terms Code (Customer)
[36:64]
Placeholders Used in This Example:
[36:2] - Sales Header (Table 36): Sell-to Customer No. (Field 2) - Links order to customer
[18:1] - Customer (Table 18): No. (Field 1) - Customer number for linking
[36:64] - Sales Header (Table 36): Payment Terms Code (Field 64) - Target field on order
[18:27] - Customer (Table 18): Payment Terms Code (Field 27) - Source field from customer defaults
Empty check: [36:64] is '' - Condition to check if payment terms not yet set
Result: New orders automatically receive customer's default payment terms.
Multiple Field Copying
Rule 3: Synchronize Shipping InformationAction - Multiple Assigns:
Assign 1:
Target: [36:13]
Formula: [18:CustomDefaultShipToCode]
Assign 2:
Target: [36:31]
Formula: [18:CustomDefaultShippingAgent]
Assign 3:
Target: [36:CustomShipMethod]
Formula: [18:CustomDefaultShipMethod]
Result: Complete shipping configuration automatically applied from customer defaults.
Part 3: Calculated Field Assignments
Arithmetic Calculations
Assign actions support mathematical operations for computed field values.
Validation Set: Sales Line - Discount Calculation - OnValidate
Rule 1: Calculate Volume DiscountTable: Sales Line (37)
Condition:
[37:15]
Action - Assign:
Target Field: [37:11]
Formula: IF([37:15] >= 500, 15,
IF([37:15] >= 250, 10,
IF([37:15]
Placeholders Used in This Example:
[37:15] - Sales Line (Table 37): Quantity (Field 15) - Used both in condition and in nested IF statements
[37:11] - Sales Line (Table 37): Line Discount % (Field 11) - Target field for calculated discount
IF([37:15] >= 500, 15, ...) - Nested conditional expression: Returns 15 if quantity 500+, else evaluates next IF
Threshold checks: Compares quantity against 500, 250, 100 to determine discount tier
Result: Line discount automatically calculated based on quantity thresholds.
String Manipulation
Rule 2: Generate Description from ComponentsSource References:
1. Item (27)
Link via: [37:6] = [27:1]Action - Assign:
Target Field: [37:11]
Formula: [27:3] + ' - ' + [37:15] + ' units @ $' + [37:22]
Result: Line description automatically formatted with item details.
Date Calculations
Rule 3: Calculate Expected Receipt DateValidation Set: Purchase Line - Lead Time Calculation - OnValidate
Source References:
1. Item (27)
Link via: [39:6] = [27:1]Action - Assign:
Target Field: [39:CustomExpectedReceiptDate]
Formula: [38:20] + [27:12]
// Order Date + Lead Time Calculation (days)
Where:
[38:20] = Order Date
[27:12]
Placeholders Used in String and Date Examples:String Concatenation (Rule 2):
[37:6] - Sales Line (Table 37): No. (Field 6) - Item number for linking
[27:1] - Item (Table 27): No. (Field 1) - Item number for linking
[27:3] - Item (Table 27): Description (Field 3) - Item description text
[37:15] - Sales Line (Table 37): Quantity (Field 15) - Quantity value in string
[37:22] - Sales Line (Table 37): Unit Price (Field 22) - Unit price value in string
[37:11] - Sales Line (Table 37): Description field (Field 11) - Target field for concatenated result
String operators: + - Concatenates text and field values, ' - ' and ' units @ $' - Literal text in formula
Date Calculation (Rule 3):
[39:6] - Purchase Line (Table 39): Item No. (Field 6) - Links to item
[27:1] - Item (Table 27): No. (Field 1) - Item number
[38:20] - Purchase Header (Table 38): Order Date (Field 20) - Base date for calculation
[27:12] - Item (Table 27): Lead Time Calculation (Field 12) - Days to add to order date
Date addition: [38:20] + [27:12] - Adds lead time days to order date
[39:CustomExpectedReceiptDate] - Purchase Line (Table 39): Custom expected receipt date field - Target field
Result: Expected receipt automatically calculated from order date and item lead time.
Part 4: Conditional Assignments
IF Statement Logic
Assign actions support IF statements for conditional value assignment based on complex criteria.
Validation Set: Sales Order - Payment Terms Assignment - OnInsert
Rule 1: Assign Payment Terms Based on Credit Rating and AmountSource References:
1. Customer (18)
Link via: [36:2] = [18:1]Action - Assign:
Target Field: [36:64]
Formula:
IF([18:CustomCreditRating] is 'A' AND [36:109] > 10000,
'NET60',
IF([18:CustomCreditRating] is 'A',
'NET45',
IF([18:CustomCreditRating] is 'B' AND [36:109] <= 5000,
'NET30',
IF([18:CustomCreditRating]
Placeholders Used in This Example:
[36:2] - Sales Header (Table 36): Sell-to Customer No. (Field 2) - Links to customer
[18:1] - Customer (Table 18): No. (Field 1) - Customer number
[18:CustomCreditRating] - Customer (Table 18): Custom Credit Rating field - Credit rating value (A, B, C, etc.)
[36:109] - Sales Header (Table 36): Amount Including VAT (Field 109) - Order amount for threshold checks
[36:64] - Sales Header (Table 36): Payment Terms Code (Field 64) - Target field for assignment
Complex nested IF: Evaluates rating and amount conditions to return appropriate payment terms code
Conditions: [18:CustomCreditRating] is 'A', [36:109] > 10000, [36:109] <= 5000 - Logical comparisons in IF statements
Return values: 'NET60', 'NET45', 'NET30', 'NET15', 'PREPAY' - Payment terms codes assigned based on conditions
Result: Payment terms automatically assigned based on customer credit rating and order value.
Multi-Condition Logic
Rule 2: Calculate Shipping ChargesSource References:
1. Customer (18)
Link via: [36:2] = [18:1]Action - Assign:
Target Field: [36:CustomShippingCharge]
Formula:
IF([18:CustomFreeShipping] is true,
0,
IF([36:109] > 500,
0,
IF([18:10] is in ('10000-19999', '20000-29999'),
15,
IF([18:10]
Placeholders Used in This Example:
[36:2] - Sales Header (Table 36): Sell-to Customer No. (Field 2) - Links to customer
[18:1] - Customer (Table 18): No. (Field 1) - Customer number
[18:CustomFreeShipping] - Customer (Table 18): Custom Free Shipping field - Boolean flag for free shipping eligibility
[36:109] - Sales Header (Table 36): Amount Including VAT (Field 109) - Order total for threshold check
[18:10] - Customer (Table 18): Post Code (Field 10) - Customer postal code for zone determination
[36:CustomShippingCharge] - Sales Header (Table 36): Custom Shipping Charge field - Target field for calculated charge
IS IN operator: Checks if post code falls within specified zone ranges ('10000-19999', '20000-29999', etc.)
Nested IF logic: Free shipping customers → Orders over $500 → Local zones → Regional zones → Remote zones (default)
Result: Shipping charges automatically calculated from customer location, free shipping status, and order amount.
Part 5: Aggregate-Based Assignments
Using SUM in Assignments
Assign actions can use aggregate functions to compute values from related records.
Validation Set: Customer - Credit Utilization - OnModify
Rule 1: Calculate Current Credit UtilizationTable: Customer (18)
Source References:
1. Sales Header (36) - Open orders
Link via: [18:1] = [36:2]
Reference Filters:
[36:1] is 'Order'
[36:120] is 'Open'
2. Customer Ledger Entry (21) - Unpaid invoices
Link via: [18:1] = [21:3]
Reference Filters:
[21:13] is false // Open
[21:14]
Action - Assign:
Target Field: [18:CustomCurrentExposure]
Placeholders Used in This Example:
[18:1] - Customer (Table 18): No. (Field 1) - Customer number for linking
[36:2] - Sales Header (Table 36): Sell-to Customer No. (Field 2) - Links orders to customer
[36:1] - Sales Header (Table 36): Document Type (Field 1) - Filter for 'Order' type
[36:120] - Sales Header (Table 36): Status (Field 120) - Filter for 'Open' status
SUM(36:109) - Aggregate sum of Sales Header: Amount Including VAT (Field 109) - Total of all open orders
[21:3] - Customer Ledger Entry (Table 21): Customer No. (Field 3) - Links ledger entries to customer
[21:13] - Customer Ledger Entry (Table 21): Open (Field 13) - Filter for open entries (false = not closed)
[21:14] - Customer Ledger Entry (Table 21): Remaining Amount (Field 14) - Outstanding amount on entry
SUM(21:14) - Aggregate sum: Total of remaining amounts on unpaid invoices
[18:CustomCurrentExposure] - Customer (Table 18): Custom Current Exposure field - Target field for total exposure
Aggregate addition: SUM(36:109) + SUM(21:14) - Combines open orders and unpaid invoices for total exposure
Source Reference filtering: Filters configured in linked table setup, not in aggregate formula
Result: Customer credit utilization automatically updated when orders or invoices change.
Using COUNT for Status
Rule 2: Update Item Active StatusValidation Set: Item - Activity Status - OnModify
Source References:
1. Sales Line (37)
Link via: [27:1] = [37:6]
Reference Filters:
[37:CustomOrderDate] >= [T]
Action - Assign:
Target Field: [27:CustomActiveStatus]
Placeholders Used in This Example:
[27:1] - Item (Table 27): No. (Field 1) - Item number for linking
[37:6] - Sales Line (Table 37): No. (Field 6) - Item number on sales line for linking
[37:CustomOrderDate] - Sales Line (Table 37): Custom Order Date field - Date filter for recent activity
[T] - System placeholder: Today's date - Used in date range calculation
Date arithmetic: [T] - 90 - Calculates date 90 days ago from today
COUNT(37:*) - Aggregate function: Counts number of Sales Line records matching filters (asterisk counts all matching records)
Source Reference filtering: Filter [37:CustomOrderDate] >= [T] - 90 configured in linked table setup
[27:CustomActiveStatus] - Item (Table 27): Custom Active Status field - Target field for status
Conditional assignment: IF(COUNT(37:*) > 0, 'Active', 'Inactive') - Returns 'Active' if count greater than 0, else 'Inactive'
Result: Item status automatically reflects recent sales activity.
Using AVG for Analytics
Rule 3: Calculate Average Order ValueSource References:
1. Sales Header (36) - Posted orders
Link via: [18:1] = [36:2]
Reference Filters:
[36:120] is 'Posted'
[36:20] >= [T]
Action - Assign:
Target Field: [18:CustomAvgOrderValue]
Result: Customer average order value automatically maintained.
Part 6: Multi-Field Coordinated Updates
Updating Multiple Related Fields
Single rule can execute multiple assign actions to maintain data consistency across related fields.
Validation Set: Item - Inventory Status Update - OnModify
Rule 1: Update Inventory ClassificationTable: Item (27)
Source References:
1. Item Ledger Entry (32)
Link via: [27:1] = [32:5]Condition:
{27:Inventory} <> [27:Inventory]
Actions - Multiple Assigns:
Assign 1 - Inventory Status:
Target: [27:CustomInventoryStatus]
Formula: IF([27:Inventory] <= 0,
'Out of Stock',
IF([27:Inventory] <= [27:15],
'Low Stock',
IF([27:Inventory] <= [27:15] * 2,
'Normal',
'Overstock'
)
)
)
Assign 2 - Last Stock Change Date:
Target: [27:CustomLastStockChange]
Formula: [T]
Assign 3 - Stock Change Amount:
Target: [27:CustomLastStockChangeQty]
Formula: [27:Inventory] - {27:Inventory}
Assign 4 - Reorder Urgency:
Target: [27:CustomReorderUrgency]
Formula: IF([27:Inventory] <= [27:15] * 0.5,
'Urgent',
IF([27:Inventory] <= [27:15]
Result: Inventory change triggers coordinated update of status, date, change amount, and reorder urgency fields.
Cascading Field Updates
Rule 2: Order Status ManagementValidation Set: Sales Order - Status Cascade - OnModify
Actions - Cascading Logic:
Assign 1 - Processing Status:
Target: [36:CustomProcessingStatus]
Formula: IF([36:120] is 'Released',
'Ready for Shipment',
IF([36:120] is 'Open',
'In Progress',
'On Hold'
)
)
Assign 2 - Priority Based on Status:
Target: [36:CustomPriority]
Formula: IF([36:CustomProcessingStatus] is 'Ready for Shipment',
'High',
IF([36:CustomProcessingStatus] is 'On Hold',
'Low',
'Normal'
)
)
Assign 3 - Expected Ship Date:
Target: [36:CustomExpectedShipDate]
Formula: IF([36:CustomPriority] is 'High',
[T] + 1,
IF([36:CustomPriority] is 'Normal',
[T] + 3,
[T]
Result: Single status change cascades through processing status, priority, and expected ship date with interdependent logic.
Part 7: Best Practices and Patterns
Performance Considerations
Optimize aggregate calculations:
✓ Good: SUM with date filters
SUM(36:109 WHERE [36:20] >= [T]
Minimize calculation complexity:
✓ Good: Simple conditions
IF([Field]
Field Update Timing
OnValidate scenario:
Fires when specific field changes
Immediate user feedback
Use for: Related field updates, calculated fields
OnModify scenario:
Fires on any field change
Can execute frequently
Use for: Status management, timestamps
BeforePost scenario:
Fires once before posting
Final calculations
Use for: Totals, final status, audit fields
Testing Checklist
Before deploying assign actions:
Verify target field is editable (not blocked)
Test with various data types (null, zero, negative)
Confirm formula syntax (no undefined fields)
Check aggregate performance with production data volumes
Validate conditional logic covers all scenarios
Test multi-field updates in correct sequence
Verify no circular references (Field A → Field B → Field A)
Common Patterns
Pattern 1: Status Derivation
Pattern 2: Default Value Application
Pattern 3: Computed Metrics
Summary and Key Takeaways
This guide covered automatic field value assignment using QUALIA Assign actions in Microsoft Dynamics 365 Business Central:
Static assignments set fixed values (text, numbers, dates, booleans)
Field copying transfers values within or across tables
Calculated formulas compute values using arithmetic, string operations, date math
Conditional logic applies different values based on IF statement evaluation
Aggregate assignments derive values from SUM, COUNT, AVG of related records
Multi-field updates coordinate changes across related fields
Practical applications:
Automate status field management based on business conditions
Copy default values from master data to transaction records
Calculate discounts, dates, and derived values automatically
Apply conditional logic for complex business rules
Maintain analytical fields with aggregate calculations
Coordinate multi-field updates for data consistency
Implementation exercise: Create an automatic priority assignment rule:
Identify priority criteria (customer type, order amount, urgency)
Configure conditional logic for priority determination
Set up automatic assignment on order creation
Test various customer and order scenarios
Verify priority correctly influences downstream processes
Monitor effectiveness over 30 days
Related topics:
Blog 017: Multi-Condition Validation (conditional logic patterns)
Blog 024: Aggregate Calculations (SUM, COUNT, AVG usage)
Blog 030: Understanding Scenarios (timing of assign actions)
Blog 031: Advanced Table Linking (cross-table value copying)
This blog is part of the QUALIA Rule Engine series for Microsoft Dynamics 365 Business Central. Follow along as we explore business rule automation patterns.
