Search This Blog

Thursday, March 31, 2016

Business Rule in CRM



There are three levels of scope:
ScopeWhere it runs run
EntityAll forms and server
All formsAll forms
Specific formJust 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:
Business Rules #1
Business Rules #1
  • 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:
crm 2015 bpa2
Trigger the workflow from a record and get below error message immediately:
crm 2015 bpa3
The record cannot be saved due to “Business Process Error”:
crm 2015 bpa4
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:
crm 2015 bpa5
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.