#REDIRECT [[Workflow|WorkflowsWorkflows_Overview#Trigger_a_Workflow_from_a_Custom_Browser_Script]] can be triggered based on a value in a [[Custom Fields|custom field]] on the object using a [[Browser|browser]] script. The [[Workflow|workflow]] id is passed to the system from the script.
This procedure is for use within the [[UTA]] only. ==Syntax==:<font size="3">'''_triggerwf(''objectid'',''workflowid'',''[[Entity IDs|Entity ID]]'');''' </font> 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 In the browser script you would use triggerwf with the following syntax:<br>'''Level 1''': _triggerwf('@opportunityid@',''workflowid'');<br>:Example: _triggerwf('@opportunityid@',98765); '''Level 2''': _triggerwf('@eventid@',''workflowid'',26);<br>: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 [[Workflow|workflows]] triggered by a [[Browser Script]] within a [[UTA]] you should set '''Trigger When''' to '''--Deactivate--''' rather than selecting a [[Status]]. ==Example==To create a button that triggers a workflow at Level 2: Create a [[Custom Field Type: Read Only – System Variables|Read Only – System Variables]] Custom Field. In the '''Text/Link:''' section include the following: <input type="button" class=Button value="Button Label" onClick="_triggerwf('@eventid@',''workflowid'',26);"/> ==See Also==* [[Entity IDs]] [[Category:Workflows]][[Category:JavaScript]][[Category:Custom Fields]]{{DeprecatedPage}}