With other exciting features, Microsoft Dynamics CRM 2015 also introduced new following enhancement in business rules:
- Set default value
- Support for Server Side logic
- Support for OR operator
- Support for else
Setting Default Value – This is a very useful enhancement which can help us in different business scenarios for example, let’s say you have one default pricelist that you want to set in opportunity, earlier we used to write retrievemultiple call to set default pricelist based on it’s name. But now we can simply design business rule to set default price list
Once activated, it will set default pricelist when opportunity record is created.
This is especially useful to set some default value to required fields automatically.
Support for Server Side logic – Initially business rules released for client side validation, but Microsoft Dynamics CRM 2015 added support to run these validation on server side as well, so now we can configure our business rule to run both client and server side. A new scope “Entity” is added in business rules designer which enables to run our business logic at server side as well, let’s take above example and activate it using Entity scope. Like below
Now let’s create opportunity using code, like below
private void Businesslogicdemo(IOrganizationService iorganizationService)
//Create entity class object and pass entity name
Entity opportunityEntity = new Entity(“opportunity”);
//call create method to create opportunity
Please note we are not adding any attribute value, but as soon as this code is executed it will also run our business logic and our default values will be available in opportunity record like following
Support for OR operator – Now business rule also supports OR logical operator, so we can have two condition and we can use And/OR logical operator between these conditions based on requirement.
Support for else – This is another new enhancement in business rules, earlier there was no support for else, so if you want to make any field required based on some condition in MS CRM 2013, you need to create two business rule one to make that required and another to make that field not required, but in MS CRM 2015 we can simply add else statement.
HIMBAP | Need any help in Microsoft CRM 2015 Contact US !!