Restricting Workflow rules to Assigned User

By | May 14, 2014

In SageCRM workflow is an efficient way of systematic progress on work and related tracking. Workflow can be applied to any of the entities such as Case, Lead, and Opportunity etc. But how to handle the security of this workflow in order to make sure that no unwanted user can misuse it and disturb the business flow? This can be done by restricting the workflow rule to Assigned user only. Here is how.
Greytrix Self Service Portal: Customer retention – Food for thought:
Customer Retention: The forgotten domain? Part – I
Customer Retention: The forgotten domain? Part – II
Navigate to below path, and click on the particular workflow you need to make restrictions to.
Administration | Advanced Customization | Workflow
Bring the workflow to edit mode by clicking on Edit workflow button, then click on any of the workflow rule you want restrict it to. Below screen will be displayed.
1
Paste the below code under JavaScript condition field and Save.
<Snippet>
// Get Current User iD
var iUserID= new String(eWare.GetContextInfo(“user”,”user_userid”))
if(iUserID==”” || iUserID==”undefined” || iUserID==”NULL”) iUserID=”0″;
// Get Assigned User Id from Lead
var iassigneduserid= new String(eWare.GetContextInfo(“lead”,”lead_assigneduserid”)) if(iassigneduserid==”” || iassigneduserid==”undefined” || iassigneduserid==”NULL”) iassigneduserid=”0″;
iUserID=parseInt(iUserID);
iassigneduserid=parseInt(iassigneduserid);
if(iassigneduserid==iUserID)
Valid=true;
else
Valid=false;
<Snippet>
Also Read:
1) Creating tasks through workflow with defined due period
2) Setting Default Date Time while progressing through Sage CRM Workflow
3) Progressing workflows through Interactive Dashboard
4) Disabling Workflow for an Entity
5) Trick to set workflow for Opportunities converted from Lead