In Microsoft Dynamics CRM buiness rule we use two types of fields the one which we are using in our “if” condition and other one which we are calculating or taking an “Action”.
if you have open the form editor and click on a field property , by navigating to business rule tab you will see , CRM will tell you the current field is a primary field in which business rule and participating on which business rule:
so the difference is :
- Type – Primary : this field is being used in business rule in a “if” conidition and its the base of business rule.
- Type – Participating : this field is being calculated based on the other field (Action).
hope this helps!
Well , fortunately business rules can help if you need to perform some simple calculation on a form based on field values too. Lets get into action.
So lets create a business role.
- Add a new condition to check if Est. Closed date contains data AND the new field(date difference) doesn’t not contains data.
please note that if we don’t check the second condition the business rule will run every time and set the value to date difference on every on load even if date difference has been set last time :
- Now once we are done with condition , lets add the action to it “set field value”. and from right side select the field = “date difference” , Type = “Formula”, other field = “Est Closed Date” , Operator = “-“, Type = “Value” , Days = “10”. Take a look at reference below:
- now lets apply , save , Activate the business rule.
- Lets open a record a with estimated closed date and see it in action 🙂
- the date difference field has been set to 10 days before the est close date which is 24-02-2017.
There you go , it was simple example but i am sure you can perform some more complex calculation and not on just date fields but on currency and other fields.
Hope this helps!