Configure rules in Business Rule module

In order to create rule-based on workflow includes below mentioned steps:

  • Rule (Event type)

  • Action Types

  • Condition Types

  • Variable Types

  • Flowchart diagram

 

Rule (Event type): Rule is a type of container that stores the event type. These items can have Actions or Conditions.

  1. Entity

    1. After saving Entity

    2. Before saving Entity

    3. Entity delete

    4. Entity form alter

    5. Entity form validation

    6. Entity Insert

    7. Entity is loaded

    8. Entity is viewed

  2. System

    1. Kernel request

  3. User

    1. User has logged in

    2. User has logged out

Action Types: The action is a type of item to execute something. Each action has its particular behavior and may or may not be context-dependent. One action can live in multiple items: actions, conditions, and rules. When you delete one action, all references to it are removed as well.

  1. Action Set

  2. Entity

    1. Change entity form field

    2. for an entity

    3. Display error message in a form

    4. Publish an entity

    5. Set field value

    6. Unpublish an entity

  3. System

    1. Page redirect

    2. Send mail

    3. Show a message

  4. User

    1. Add role to user

    2. Remove role from user

  5. Variable

    1. Calculate a value

    2. Fetch entity by value

    3. Loop through a view result variable

    4. Save entity variable

    5. Set values to entity variable

Condition Types: The condition is a type of item to evaluate some expression. Each condition can live in multiple items: actions, conditions, and rules. When you delete one condition.

Each condition has two paths: success and failure. You can add other conditions and/or actions to each path.

  1. Entity

    1. Data comparison

  2. Logical

    1. Logical AND

    2. Logical OR

  3. User

    1. Logged user has role

  4. Variable

    1. User variable has role

    2. Variable data comparison

  5. Views

    1. Check the number of results returned by a view

    2. Compare the number of results between two views

Variable Types: Variables are a type of item that stores temporary values allowing the Actions and Conditions to perform their evaluation using it. You can use variables inside variables, and each variable can be referenced multiple times in multiple items. When one variable is deleted, you will need to update manually each item that refers to it. Inside the edit page of each variable, it's possible to see all items that refer to the variable.

The syntax to use variables are {{variable_id}} or {{variable_id->field_id}}

Variable Types

  1. Entity

    1. Empty entity variable

    2. Value from entity field

  2. User

    1. User variable

  3. Variable

    1. Custom value

  4. Views

    1. View result variable

 

Variable type (Views - view result variable): when you will select the option “view result variable“

Note: When we wanted to render any views result from the field then we have followed below mentioned step:

Step1: Firstly, we have to create a view with the expected result field by setup under the structure > views. (In the below screenshot I am creating a view for rendering specific User role and their associated users).

Step2: Once the view will be set up then you can use that particular view in the business rule variable section by selecting “Views - view result variable” in the dropdown. refer below 2 images with 2 screen.

Step3: Once you will select the view from the dropdown list then you will get all the fields as tokens in the admin section for the actions and conditions. refer below image.

Step4: The user role data will be available in the action send out the email by selecting anyone.