Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:extensions:workflowdesigner:httphandler [2014/01/01 23:39] swarnat [HTTP Handler] |
en:extensions:workflowdesigner:httphandler [2016/11/14 01:18] (current) swarnat |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== HTTP Handler ====== | + | ====== Execution: Remote over HTTP Handler ====== |
This feature allows you to execute Workflow from any System, which could initiate HTTP Post Requests. You could also submit any values to the workflow and access these variables from every task. | This feature allows you to execute Workflow from any System, which could initiate HTTP Post Requests. You could also submit any values to the workflow and access these variables from every task. | ||
Line 8: | Line 8: | ||
<WRAP info> | <WRAP info> | ||
=== use cases === | === use cases === | ||
- | * replacement of Webserive for Record Creation, like Forms on Webpage for Lead collection | + | * replacement of Webservice for Record Creation, like Forms on Webpage for Lead collection |
* execute special processes from webpage (External Administrations) if the record ID of organization is known (generation of quotes, ...) | * execute special processes from webpage (External Administrations) if the record ID of organization is known (generation of quotes, ...) | ||
</WRAP> | </WRAP> | ||
Line 27: | Line 27: | ||
* //192.168.0.0/24// | * //192.168.0.0/24// | ||
* The Trigger drop down will show all created triggers | * The Trigger drop down will show all created triggers | ||
- | * The Workflow drop down will show all workflow together with the ID, which is needed for the execution | + | * The Workflow drop down will show all workflows together with the ID, which you need for the execution |
===== Workflow selection ===== | ===== Workflow selection ===== | ||
To configure the Workflow/Trigger you want to execute, use the following GET Variables: | To configure the Workflow/Trigger you want to execute, use the following GET Variables: | ||
- | * **workflow_trigger**\\ Which trigger should be triggered. Set by trigger key (CUSTOM_43) | ||
* **record_id**\\ Which record from CRM should be used by Workflow Designer to append the Workflow\\ If you don't want to connect a record, set the record_id = 0 | * **record_id**\\ Which record from CRM should be used by Workflow Designer to append the Workflow\\ If you don't want to connect a record, set the record_id = 0 | ||
* **workflow_id**\\ Which Workflow should be executed? You get the Workflow ID from the URL in administration | * **workflow_id**\\ Which Workflow should be executed? You get the Workflow ID from the URL in administration | ||
Line 48: | Line 47: | ||
The values could be used inside the executed workflows in the **$env** variable. | The values could be used inside the executed workflows in the **$env** variable. | ||
- | For example if you submit a variable //lastname// to the workflow, you could access the variable in every task of this workflow by using ''$env["lastname"]''. | + | For example if you submit a variable //lastname// to the HTTP Handler URL, you could access the variable in every task of this workflow by using ''$env["lastname"]''. |
- | ===== Technical implementation ===== | ||
- | |||
- | - Call ''<urlofvtigerCRM>/modules/Workflow2/HTTPHandler.php?<ExecutionConfiguration>'' | ||
- | - Submit any Variable you want to use in Workflow via POST values. | ||
- | - At the moment, there is no useful return value | ||
===== Examples ====== | ===== Examples ====== | ||
Line 61: | Line 55: | ||
<code php> | <code php> | ||
- | $url = '<urlofvtigerCRM>/modules/Workflow2/HTTPHandler.php?<ExecutionConfiguration>'; | + | $url = '<urlofvtigerCRM>/<shorturl>&<ExecutionConfiguration>'; |
+ | |||
+ | $fields = array( | ||
+ | 'firstname' => "Firstname", | ||
+ | 'lastname' => "Lastname", | ||
+ | 'street' => "streetname 123" | ||
+ | ); | ||
+ | |||
+ | foreach($fields as $key=>$value) { | ||
+ | $fields_string .= $key.'='.urlencode($value).'&'; | ||
+ | } | ||
+ | rtrim($fields_string, '&'); | ||
+ | |||
+ | $ch = curl_init(); | ||
+ | |||
+ | curl_setopt($ch,CURLOPT_URL, $url); | ||
+ | curl_setopt($ch,CURLOPT_POST, count($fields)); | ||
+ | curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); | ||
+ | curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); | ||
+ | $result = curl_exec($ch); | ||
+ | curl_close($ch); | ||
+ | </code> | ||
+ | |||
+ | You want to execute the workflow with the **ID 77** on the **record 852** you need to write: | ||
+ | |||
+ | <code php> | ||
+ | $url = '<urlofvtigerCRM>/<shorturl>?record_id=852&workflow_id=77'; | ||
$fields = array( | $fields = array( |