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.
Entity
After saving Entity
Before saving Entity
Entity delete
Entity form alter
Entity form validation
Entity Insert
Entity is loaded
Entity is viewed
System
Kernel request
User
User has logged in
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.
Action Set
Entity
Change entity form field
for an entity
Display error message in a form
Publish an entity
Set field value
Unpublish an entity
System
Page redirect
Send mail
Show a message
User
Add role to user
Remove role from user
Variable
Calculate a value
Fetch entity by value
Loop through a view result variable
Save entity variable
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.
Entity
Data comparison
Logical
Logical AND
Logical OR
User
Logged user has role
Variable
User variable has role
Variable data comparison
Views
Check the number of results returned by a view
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
Entity
Empty entity variable
Value from entity field
User
User variable
Variable
Custom value
Views
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.