Salesforce Visual Workflow has made the life of admins so much easier, with the simplicity to integrate and interconnect business processes without thousands of lines of code. To take this one step further, we’ve put together a plugin which allows you to send data using a plugin from Salesforce Visual Workflow through a POST JSON webhook to any 3rd party service (such as Zapier). While it is extremely simply in its design, it is a huge advantage to be able to move data between business systems without the need to spend hours developing your own connectors.
Implementation Time: 15 Minutes
Prerequisites:
- Salesforce Edition with ‘Visual Flow’ (Pro/Enterprise)
- Zapier or other 3rd party webhook endpoint
Install the Salesforce Package:
The package we have created is comprised of a single APEX Class which creates the plugin inside Salesforce Visual Workflow.
- Click the following link to Install the unmanaged package
- If everything is correctly installed, you should be able to see the new plugin when you open up a new or existing flow.
Add a remote site:
Before any web service calls can be made, Salesforce Remote Sites must be configured to allow for outbound communication to send the POST request. In our particular case we are using Zapier, so we will add the Zapier hooks URL to our remote sites configuration.
- Inside Salesforce navigate to Setup > Security Controls > Remote Site Settings
- Click on New Remote Site
- Add in the domain for your endpoint. In the example below you can see we are using Zapier (https://hooks.zapier.com).
Test out your Webhook
The plugin has been set with 15 variables, but you can always modify the code to add more if you need it.
- Open a new or existing Visual Workflow inside Salesforce.
- Drag the HTTP POST Plugin element onto your canvas and configure the variables you want.
- The PostURL should be your Zapier endpoint url
- The Var‘s which are listing below can be populated with any variables or static variables like you can see below.
(Optional) If you’re using Zapier, setup a Webook Trigger like the below which will catch the variables when you post them.
As I’m not an APEX/SF developer, the code is not perfect, but works extremely well to get data out of Salesforce Visual Workflow. If there are any developers out there I would love to hear your two cents and offer any form of improvement to this!
Well, the big suggestion would be to add an output field that provides the HTTP Response, so that it can then be parsed and assigned. My integration responds with the newly formed record that gets created in the 3rd party application, and it sends back an id that I will need to upgrade at a future date.
Hi Amanda,
Agreed – I have seen bits of code online which do this also (a long time ago). For now I haven’t had the time to implement such a feature. Feel free to update my code and add feedback for this form of support.
Best regards,
MooMaster
Hi,
Can u pls share your code.
Thanks.
Hi,
Can u pls share your code.
Thanks.
The plugin does not work.
After installing and testing the data in Zapier, I get the following data: http://jmp.sh/9A84LDe
It turns out that all variables in one line and Zapier can not process them.
Wrote in support of Zapier and received this response:
Thanks for reaching out.
Unfortunately, there is no way in your Trigger. Step to Filter the data that is coming in the raw_body object.
The “Variable 10, Variable 11, Variable 12” will not work here.
What can be done to make this work?
I understood what the problem was!
If all the variables are filled, then everything works. If at least one variable is empty, the result is all the variables in one line.
The stream works and transmits data to Zapier, but each time it comes to the mail there’s such an error:
The “Zap” element (FlowApexPluginCall) contains an error.
When trying to execute the stream of the Apex class “HttpPostPlugin”, the following error occurred: HttpPostPlugin.doAreaCalloutAsync (String, String).
What can be the problem and how can it be solved?