Progressing workflow manually through Workflow Rules

By | March 6, 2013

In Sage CRM, we can create a workflow for primary entities. There are five types of workflow rules as:

  1. Transitional rule.
  2. Global rule.
  3. Conditional rule.
  4. Primary rule.
  5. 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:

  1. 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.
  2. Create an escalation rule using Administration | Advanced Customization | Escalation and click on “New” button. You will get the below screen.
  3. Select View radio box or table radio box.
  4. Give the rule name as per your requirement like ‘Active Program’.
  5. Tick the rule enabled checkbox.
  6. 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)
  7. Click on the “Save” button, it will redirect you to the below grid.
  8. Click on the hyperlink available on “Active Program “rule. The below screen gets open.
  9. Click on the “New” button to create new action for the rule.
  10. Click on the “Execute SQL Statement”.
  11. Set the below code in the SQL statement section.                                                                     Exec ActiveProgram 
  12. 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.