In Sage CRM, we can create a workflow for primary entities. There are five types of workflow rules as:
- Transitional rule.
- Global rule.
- Conditional rule.
- Primary rule.
- Escalation rule.
We had come across a scenario where we had to progress the workflow based on the some condition. The scenario was like if “Start date” and the system date match then we need to progress the workflow from Approved state to Activate state. To do the same we can follow below mentioned steps:
- First write a stored procedure to get the record based on the condition and then progress the workflow and used the same stored procedure in the escalation rule.
- Create an escalation rule using Administration | Advanced Customization | Escalation and click on “New” button. You will get the below screen.
- Select View radio box or table radio box.
- Give the rule name as per your requirement like ‘Active Program’.
- Tick the rule enabled checkbox.
- Paste the below code in the Trigger SQL Clause. case_stage=’Approved’ and case_status=’InProgress’ and case_startdate=DATEADD(day, DATEDIFF(day, 0, getdate()), 0)
- Click on the “Save” button, it will redirect you to the below grid.
- Click on the hyperlink available on “Active Program “rule. The below screen gets open.
- Click on the “New” button to create new action for the rule.
- Click on the “Execute SQL Statement”.
- Set the below code in the SQL statement section. Exec ActiveProgram
- Click on “Save” button.
Using the above steps, when the start date and the system date match, the workflow automatically progresses from approved state to the activate state.