Home / Integrations / Salesforce / Salesforce Visual Workflow plugin – POST JSON callout to external webservice
Salesforce Visual Workflow plugin – POST JSON callout

Salesforce Visual Workflow plugin – POST JSON callout to external webservice

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.

Salesforce Visual Workflow plugin - POST JSON callout

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.

  1. Inside Salesforce navigate to Setup > Security Controls > Remote Site Settings
  2. Click on New Remote Site
  3. Add in the domain for your endpoint. In the example below you can see we are using Zapier (https://hooks.zapier.com).

Salesforce Visual Workflow plugin - POST JSON callout

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.

  1. Open a new or existing Visual Workflow inside Salesforce.
  2. Drag the HTTP POST Plugin element onto your canvas and configure the variables you want.
    1. The PostURL should be your Zapier endpoint url
    2. The Var‘s which are listing below can be populated with any variables or static variables like you can see below.

Salesforce Visual Workflow plugin - POST JSON callout

(Optional) If you’re using Zapier, setup a Webook Trigger like the below which will catch the variables when you post them.

Salesforce Visual Workflow plugin - POST JSON callout

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!

  • Was this Helpful ?
  • yes   no

About The Moo Master

As today's world moves towards more cloud based solutions, it's not always easy to find an all-in-one solution to a business problem. We focus on business development. finding new, creative and innovative ways to use different IT systems to enhance and automate business processes. We're happy to share our knowledge and solutions we've come up with over the years to some of those unique IT/Business problems.

Check Also

Wordpress form submissions to Salesforce

WordPress form submissions to Salesforce custom object (web-to-any)

Contents1 Prepare CFDB JSON query1.1 Clean up contact form fields1.2 Prepare the JSON export query2 ...

7 comments

  1. 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

  2. Hi,
    Can u pls share your code.
    Thanks.

  3. Hi,
    Can u pls share your code.
    Thanks.

  4. 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?

  5. 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.

  6. 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?

Leave a Reply

Your email address will not be published. Required fields are marked *