There are three levels of scope:
Scope | Where it runs run |
Entity | All forms and server |
All forms | All forms |
Specific form | Just that form |
In the top right of the form, use the Scope field to set the scope for the rule. “Entity” scope level is new in CRM 2015. Setting the scope of the business rule at an entity level, forces the business rule executed on both server and clients side.
For example, on update of an entity record we will set “Description” field mandatory based on some conditions. So in this case we can create Business rule as below:
- Server Side Validation
To test this business rule validation on server side, we create a real time workflow to update this record which should trigger the validation logic:
Trigger the workflow from a record and get below error message immediately:
The record cannot be saved due to “Business Process Error”:
Download log file and we can find the trace details:
<TraceText>
[Microsoft.Crm.ObjectModel:Microsoft.Crm.ObjectModel.SyncWorkflowExecutionPlugin]
[1769c1b5-1784-e411-80c5-00155d016814: ] Starting sync workflow ‘Test Scope of Business Rule’, Id: 0e69c1b5-1784-e411-80c5-00155d016814
Entering UpdateStep1_step: Sync workflow ‘Test Scope of Business Rule’ terminated with error ‘Attribute ‘new_description’ cannot be NULL’
</TraceText>
Client Side Validation To test this business rule in client side, we just simply update the record on the form and the error message show up as expected:
Thanks to inogic.com site to delivery nice article of business rule.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.