Create business rules based on business process flows

Dynamics CRM 2016
 

Updated: November 28, 2016

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

With Microsoft Dynamics 365 (online & on-premises), you can define business rules based on business processes without writing code, directly in the Dynamics 365 user interface (UI).

System_CAPS_noteNote

This topic shows how to create business rules in Dynamics CRM. For information on creating business rules in Dynamics 365, see Help & Training: Create business rules and recommendations to apply logic in a form.

You can define business rules in the user interface based on:

  • Currently active business process that is rendered on a form in the UI.

  • Active stage of the business process. An active stage is the stage that you're currently on.

  • Selected stage of the business process. A stage that you select in the process flow. This stage may or may not be the active stage.

  • Stage category of the business process. A category lets you group stages by a type of action. The options for the stage category come from the Stage Category global option set. You can add options to this global option set and change the labels of existing options if you want.

To learn more about business process flows, see: Business process flows and Help & Training: Create a new business process flow.

A business rule is triggered by the business process events, such as when a process changes to a new active stage or a stage is selected. The execution of the business logic will cause the business process flow UI page to update. You’ll be able to customize the UI to show or hide particular fields at different stages of the process flow or mark certain fields as business required.

When you create business rules based upon business process flows, consider the following information about a business rule execution.

  • Conditions based on the business process flow in business rules with the entity scope are evaluated on the server for the following cases:

    • If the condition is based only on the process flow and not on stages.

    • If the condition is based on the process flow and the active stage.

    • If the condition is based on the stage category of the active stage.

  • Conditions based on the business process flow with the entity scope aren't valid for the following cases:

    • If the condition is based on the process flow and the selected stage.

    • If the condition is based on the stage category of the selected stage.

  • A business rule based on a business process flow is executed:

    • On change of the business process if the rule is based only on the process flow and not on stages.

    • On change of the business process or on change of the active stage if the selection for the Field column for stages is Active Stage.

    • On change of the process or on change of the selected stage if the selection for the Field column for stages is Selected Stage.

  • A business rule defined on the stage category for the active stage is executed on change of the process or on change of the active stage in the process.

  • A business rule defined on the stage category for the selected stage is executed on change of the process or on change of the selected stage in the process.

To define the business rules, you have to navigate to Microsoft Dynamics 365 > Settings > Customization > Customize the System. Under Components, expand the entity that you want to define the business rule for and click Business Rules in the navigation pane. To define a new rule, click New.

The following examples depict business rules defined for the Opportunity entity. They represent several common scenarios based on the Opportunity Sales Process business process, process stages, and stage categories.

In this example, the rule is based on the Opportunity Sales Process and not tied to any particular stage. The ACTION specifies that the Account field must be shown on a form as a required field.

In the IF…THEN CONDITION, select Business Process, and then in the Type drop-down list, select Value. In the Valuelist, the Opportunity Sales Processis shown, which is the default value for the Business Process selection.

Business rule business process.

In the next example, Active Stage Rule, for the CONDITION, in the Type drop-down list, select Value With Stage, and then in the Value list, select Opportunity Sales Process. You also set the Active Stage to Propose, as shown here.

Business rule  active stage condition.

For the Propose stage, specify the Description field as required. The field will show in the process flow UI with a label containing the asterisk character, like this, Description*. In the ELSE IF CONDITION, specify the Definition field as optional, for the Qualify or Develop stages. To define the Description field as required, in the ACTION, you have to select the Set business required option, then select Description in the Field drop-down list, and then select Business Required in the Status list. In the ELSE IF CONDITION, select Not Business Required.

Business rule active stage action.

A complete example:

Business rule active stage.

The Selected Stage Rule is similar to the previous example, only for the currently selected stage in the process flow UI.

Business rule selected stage.

The following examples show the business rules based on the stage category: active stage and selected stage. Instead of selecting Business Process in the IF…THEN CONDITION, you select Stage Category (Active Stage), and then select a stage category. Also, make a Description a required field for the Propose stage category and not a required field for other categories, as shown here.

Business rule active stage category.

Business rule selected stage category.

© 2016 Microsoft. All rights reserved. Copyright

Community Additions

ADD
Show: