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

From SmartWiki
Jump to: navigation, search
Line 16: Line 16:
  
 
In the browser script you would use triggerwf with the following syntax:<br>
 
In the browser script you would use triggerwf with the following syntax:<br>
'''Level 1''':  _triggerwf(@opportunityid@,''workflowid'');<br>
+
'''Level 1''':  _triggerwf('@opportunityid@',''workflowid'');<br>
 
:Example:
 
:Example:
  _triggerwf(@opportunityid@,98765);
+
  _triggerwf('@opportunityid@',98765);
  
  
'''Level 2''':  _triggerwf(@eventid@,''workflowid'',26);<br>
+
'''Level 2''':  _triggerwf('@eventid@',''workflowid'',26);<br>
 
:Example:
 
:Example:
  _triggerwf(@eventid@,98765,26);
+
  _triggerwf('@eventid@',98765,26);
 
('''26''' is the objecttype for Level 2 activities, and will be the same for all Level 2 workflows)
 
('''26''' is the objecttype for Level 2 activities, and will be the same for all Level 2 workflows)
  

Revision as of 14:08, 6 May 2010

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


This procedure is for use within the UTA only.

Syntax

_triggerwf(objectid,workflowid,[entityid (l2 only)]);


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


In the browser script you would use triggerwf with the following syntax:
Level 1: _triggerwf('@opportunityid@',workflowid);

Example:
_triggerwf('@opportunityid@',98765);


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

Example:
_triggerwf('@eventid@',98765,26);

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


NOTE: For workflows triggered by a Browser Script within a UTA you should set Trigger When to --Deactivate-- rather than selecting a Status.


See Also