Difference between revisions of "Trigger a Workflow from a Custom Browser Script"

From SmartWiki
Jump to: navigation, search
Line 1: Line 1:
 
[[Workflow|Workflows]] can now be triggered based on a value in a [[Custom Fields|custom field]] on the object using [[Browser|browser]] script. The [[Workflow|workflow]] id is passed to the system from the script.   
 
[[Workflow|Workflows]] can now be triggered based on a value in a [[Custom Fields|custom field]] on the object using [[Browser|browser]] script. The [[Workflow|workflow]] id is passed to the system from the script.   
  
'''Impact''':  If it's a [[UTA]] [[Workflow|workflow]] you must create a status that will not be used by any other [[Workflow|workflow]] as the One-Status-One-Workflow restriction is still in effect.
+
You must first create the workflow. Once it has been created you need to find the workflow ID (''wfid'') as follows:
 +
* From the list view of Workflows right-click on the appropriate workflow and select Properties.
 +
* The URL/Address displayed will have the ''wfid'':
 +
  <nowiki>http://youraddress.smartsimple.com/WFE2/wf_viewworkflow.jsp?wfid=98765</nowiki>
 +
For the above example the workflow ID is 98765
  
[[Category:Workflows]][[Category:Enhancements]][[Category:Custom Fields]]
+
* '''Level 2''':
 +
_triggerwf(@eventid@,''workflowid'',26);
 +
(the '''26''' is the objecttype for Level 2 activities, and will be the same for all Level 2 workflows)
 +
 
 +
 
 +
'''NOTE''':  If you are using a script initiated by a [[Workflow|workflow]] in a [[UTA]] you must ensure that the status is not used by any other [[Workflow|workflow]]. This is because you can only have one [[Workflow|workflow]] per status.
 +
 
 +
 
 +
[[Category:Workflows]][[Category:JavaScript Examples]][[Category:Custom Fields]]

Revision as of 15:44, 8 April 2009

Workflows can now be triggered based on a value in a custom field on the object using browser script. The workflow id is passed to the system from the script.

You must first create the workflow. Once it has been created you need to find the workflow ID (wfid) as follows:

  • From the list view of Workflows right-click on the appropriate workflow and select Properties.
  • The URL/Address displayed will have the wfid:
http://youraddress.smartsimple.com/WFE2/wf_viewworkflow.jsp?wfid=98765

For the above example the workflow ID is 98765

  • Level 2:
_triggerwf(@eventid@,workflowid,26);

(the 26 is the objecttype for Level 2 activities, and will be the same for all Level 2 workflows)


NOTE: If you are using a script initiated by a workflow in a UTA you must ensure that the status is not used by any other workflow. This is because you can only have one workflow per status.