Microsoft Dynamics® CRM Training
Introduction to Business Rules
An error occurred while loading the video. Please try again.
Welcome to Introduction to Business Rules in Microsoft Dynamics CRM. This video will detail what business rules are and how they work, and will walk you through the simple process of creating one.
Business rules allow you to define an action on a form that will be performed based on conditions of the data; the conditions themselves are determined by the data that is entered on the form. For example, a business rule may check if one field's value matches another field's value. When the condition is met, you can do a variety of things. You can automatically show an error message, set the value of a specific field, make a certain field be required, modify a field's visibility, and even unlock a field.
In short, business rules allow you to adjust how a user interacts with a form based on certain criteria.
The business rule we're about to create will track when users in the system, or employees, refer leads to the organization. So basically, if the Lead Source field is set to Employee Referral, a custom field, Referred By, will be displayed on the form. Business rules like this one save valuable screen space, only displaying additional fields when they are needed.
To begin, log in to CRM. From the homepage, click the menu icon, choose Sales, and click Leads. Click New to open the new lead form, then click Form Editor.
In the Field Explorer along the right side of the window, I'll click, drag, and drop the Referred By field to the desired location on the form; a red line will appear where the field will be placed. Referred By is a custom user lookup field I created using the New Field button you see here. Either double-click the field name, or verify a thin blue line appears around the field, indicating it is selected, then click Change Properties. Click to uncheck the "Visible by default" box within the Display tab. Click OK. What we've just done is set the field to be invisible until the business rule reveals it.
Now, to create the actual business rule.
Click Business Rules in the Home tab along the top of the window. The Field Explorer will be replaced by the Business Rules Explorer. Click New Business Rule. In the window that appears, enter the desired business rule name. It's good practice to name business rules based on their functions, so I'll name this rule "Show referred by when lead source is employee referral." Now, we can get started adding the conditions and actions for this rule, basically the if-thens. As we go, take note of the many options for the criteria. Click Add condition. First we need to define which field is being checked, so, in this case, we'll choose Lead Source from the dropdown list. For the Operator dropdown, we will leave it set to Equals for this one, though there are quite a few options. The Type dropdown is where you input what you want to compare to - field or value. For today, we're choosing Value, then we need to check the box to select the desired value in the list. Make note that you can select multiple values, if desired. For this example, we'll just choose Employee Referral. Click the green checkmark to finish adding this condition. You'll notice that the Add condition option is still visible; you can add as many conditions as you want to the business rule. Next, we need to add the action, so click Add action, and choose Set visibility from the list that appears. Choose Referred By in the field dropdown list, and leave the Status set to Show field. Click the blue checkmark to finish adding this action. Remember, just like you can add multiple conditions, you can also add multiple actions, if desired. You can even specify an "Else," or, in other words, what happens if the conditions are not met, but that isn't required. Click Save along the top of the window. After the business rule saves, click Activate. In the window that appears, click Activate again. Back in the Form Editor, click Save, then click Publish. Click Save and Close. Back on the New Lead record, refresh the page to ensure you're looking at the updated form. As you can see, the Referred By field is not visible. However, when we add Employee Referral as the lead source, the business rule is triggered and the Referred By field appears.
This is just a simple example of business rules; the conditions of business rules can be as simple or complex as is desired to dynamically adjust forms, allowing you to clean forms of unnecessary fields, perform data validation, and adjust requirement levels of certain fields.
Thanks for watching this video by xRM!