Hash fields in Workflow Execute SQL Statements

By | July 16, 2014

Workflow is one of the powerful features of SageCRM. We can define workflow Rules for systematically updating data for the entities through workflow. Every rule must be associated with set of actions. Sage CRM Workflow has several workflow actions that can be configured for any workflow rule as shown in below diagram.
New Stuff: Implementing Browser based Spell-Checker in Sage CRM

Workflow Actions

One of the very useful workflow actions is “Execute SQL Statement”. Using this action you can write Update queries in SQL style to manipulate the current record or any related data in CRM database.

SQL Window

Simple SQL Update queries can be written as we write them in SQL Query Manager however the beauty of using all this in SageCRM is hash fields. In SageCRM we can access any field from current entity using hash tags (#). We can utilize this for Execute SQL Statement action too.
For Example:  Based on “Case Reference ID” (1-1458) you want to update case description. To do this, query in Execute SQL statement action can be written as follows.
UPDATE Cases SET Case_description=’ Ref : #Case_ReferenceId #’  WHERE Case_referenceid = ’#Case_ReferenceId#’
Also Read:
1) Hide Tracking Note field while progressing workflow
2) Restricting Workflow rules to Assigned User
3) Creating tasks through workflow with defined due period
4) Setting Default Date Time while progressing through Sage CRM Workflow
5) Disabling Workflow for an Entity