Dynamics 365 Lock and Unlock Fields Using Business Rules
Dynamics 365 Lock and Unlock Fields Using Business Rules
Business Rules in Dynamics 365 provide a powerful low-code approach for implementing business logic without writing JavaScript. One common requirement is to lock or unlock fields based on specific conditions, ensuring users can only edit information when appropriate.
Using Business Rules, administrators can dynamically control field editability, improve data quality, and enforce organizational processes across model-driven applications.
Why Lock or Unlock Fields?
- Prevent unauthorized modifications
- Maintain data accuracy
- Enforce business processes
- Reduce user errors
- Improve compliance requirements
Business Scenario
Suppose an Approval Status field contains the following values:
- Draft
- Submitted
- Approved
Once the status becomes Approved, users should no longer be allowed to modify specific fields.
Create a Business Rule
- Open the target table in Dataverse.
- Select Business Rules.
- Click New Business Rule.
- Add a Condition component.
- Select the Approval Status field.
- Configure the condition.
Configure the Condition
If Approval Status Equals Approved
Lock the Field
Drag a Set Field Requirement or Lock/Unlock action onto the True branch.
Action: Lock Field Target Field: Project Budget
Unlock the Field
On the False branch, configure the field to remain editable.
Action: Unlock Field Target Field: Project BudgetImportant: Business Rules run on forms and help enforce client-side business logic without requiring custom JavaScript development.
Activate the Business Rule
- Validate the Business Rule.
- Save the rule.
- Activate the rule.
- Publish customizations.
- Test the form behavior.
Common Use Cases
- Approval processes
- Case management
- Project tracking
- Contract management
- Financial data protection
- Employee onboarding workflows
Benefits of Business Rules
- No coding required
- Easy maintenance
- Improved user experience
- Consistent business logic
- Faster implementation
Key Takeaways
- Business Rules can lock and unlock fields dynamically.
- No JavaScript is required for basic field control.
- Improves data quality and process compliance.
- Easy to configure and maintain.
- Ideal for model-driven app customizations.