Skip to Content

Configure outbound messages with an API Manager API in Jitterbit Design Studio

Introduction

This integration design pattern sets up a Salesforce workflow rule that sends an outbound message to an API Manager API when an object changes (in this example, the Account object). A Design Studio project processes the Salesforce outbound message, maps the object's data, and saves it to a database.

Note

Send changed Salesforce object records to a database via API Manager is a similar integration design pattern that uses Integration Studio.

To set up this pattern, follow these sections in order:

  • Part 1: In Salesforce, set up a workflow rule to send an outbound message when an object changes, and download the WSDL file that defines the message.
  • Part 2: In Design Studio, set up an operation chain to receive the Salesforce outbound message, and store the mapped values in a database.
  • Part 3: In API Manager, set up an API as an endpoint for Salesforce.
  • Part 4: Return to Salesforce to update the outbound message's endpoint URL, activate the outbound message, then test the completed integration design pattern.

Part 1: Set up a Salesforce workflow rule and download the WSDL file

  1. In Salesforce, select Setup > Platform Tools > Process Automation > Workflow Rules.
  2. On the Workflow Rules page, click the New Rule button (highlighted in the image below). If a Try It in Flow Builder dialog opens, click Continue with Workflow Rules.

    Workflow rule 1

  3. On the New Workflow Rule page, click the Object menu, select Account, then click Next.

    Workflow rule 3

  4. On the Account page, enter values for the following, then click Save & Next:

    • Rule Name: Your choice of name.
    • Description: (Optional) A description for this rule.
    • Evaluation Criteria: Created, and Every Time It's Edited.
    • Rule Criteria: Click Run This Rule If the, then select Formula Evaluates to True.
    • In the formula field, enter true.

    Workflow rule 4

  5. On the Edit Rule page, click Add Workflow Action, then select New Outbound Message (highlighted in the image below).

    Workflow rule 5

  6. On the New Outbound Message page, enter values for the following, then click Save:

    • Name: Your choice of name.
    • Unique Name: This name is automatically generated based on the value for Name and the field's naming rules.
    • Description: (Optional) A description for this outbound message.
    • Endpoint URL: example.com. This temporary URL is updated later.
    • User to Send As: Enter the user that sends the outbound message. The value defaults to your Salesforce username.
    • Protected Component: Not selected.
    • Send Session ID: Not selected.
    • Account Fields to Send: Select the object fields to send. In this example, only Name and Phone are selected. The Id field is selected automatically, because it is the key field for the object.

    Workflow rule 6

  7. On the Edit Rule page, click Done.

    Workflow rule 7

  8. On the Workflow Rule page, in the Immediate Workflow Actions section, click the description link for the outbound message (highlighted in the image below).

    Workflow rule 7a

  9. In the message's Workflow Outbound Message Detail page, click the link Click for WSDL in the row labeled Endpoint WSDL (highlighted in the image below).

    Workflow rule 8

  10. An XML file opens in a new browser window. Save the file with a .wsdl extension. Depending on your operating system, you may have to set the file's extension after downloading.

Part 2: Design Studio operations

Define the 'Salesforce Outbound Message' operation

  1. Create a new Design Studio project.

  2. In the project items list on the left, right-click on Operations, then select New Operation.

  3. In the Select Type dialog, select Script, then click Continue.
  4. In the Operations window, set the operation name to Salesforce Outbound Message.

    Operation

  5. Double-click the operation's Script activity, then click Create New Jitterbit Script.

  6. In the New Script window, set values for the following, click Save, then close the script window:

    • Name: Receive Salesforce Outbound Message
    • Edit the script to match the following:

      <trans>
      $org.api.salesforce.request=$jitterbit.api.request.body;
      </trans>
      

    Operation

    This creates a global variable and sets it to the value of the predefined global variable jitterbit.api.request.body.

  7. In the Salesforce Outbound Message operation window, click Save.

  8. In the project items list on the left, right-click on Sources, then select New Source.

  9. In the Select Type dialog, select Global Variable, then click Continue.
  10. In the New Source window, set values for the following, click Save, then close the source window:

    • Name: Salesforce API Request
    • Type: Global Variable
    • Global Variable Name: org.api.salesforce.request

    Operation

Define the 'Send API response' operation

  1. Create a new operation of type Transformation. Set the operation name to Send API Response.

    Operation

  2. Double-click Transformation. In the Select Transformation dialog, click Create New Transformation.

  3. In the New Transformation window's NAME step, enter values for the following, then click Next >:

    • Name: Send API Response.
    • Source: (None).
    • Target: SOAP/WSDL Response.

    Operation

  4. In the TARGET step, select Select a Local WSDL File, click Browse..., select the WSDL file previously downloaded, then click Next > and wait for file validation.

    Operation

  5. In the TARGET step, click Next >.

    Operation

  6. On the Options page, click Finish.

    Operation

  7. In the Send API Response transformation window, expand all nodes until the element [EV?] Ack (Boolean) is visible, then double-click it.

    Operation

  8. In the Formula Builder, edit the script to match the following, then click OK to close the script editor:

    <trans>
    true
    </trans>
    

    Operation

    This is the response to the Salesforce SOAP request.

  9. In the Send API Response transformations window, click Save, then close the window.

  10. In the Send API Response operation window, right-click on the Target element, select Use API Response, then click Save:

    Operation

    The Salesforce Outbound Message operation:

    Operation

  11. Open the Salesforce Outbound Message operation, select the down arrow next to the operation name, then select On Success > Operation > Select Existing....

    Operation

  12. In the Select Success Operation dialog, select Send API Response, then click OK.

    Operation

  13. In the Salesforce Outbound Message operation window, click Save.

Define the 'Upsert Database' operation

  1. Create a new operation of type Transformation. Set the operation name to Upsert Database.

    Operation

  2. Double-click the Source activity.

  3. In the Select Source dialog, select Salesforce API Request, then click OK.

    Operation

  4. Double-click the Target element.

    Operation

  5. In the Select Target dialog, click Create New Target.

  6. In the New Target window, set values for the following, click Test Connection, then close the Database window:

    • Name: Database Endpoint.
    • Type: Database.
    • Connection Parameters: Set the parameters for your database. (A connection to a PostgreSQL server is shown in this example.)

    Operation

  7. Double-click the Transformation element.

    Operation

  8. In the Select Transformation dialog, click Create New Transformation.

  9. In the New Transformation window, enter values for the following, then click Next >:

    • Name: Upsert Database.
    • Source: SOAP/WSDL Request.

    Operation

  10. In the SOURCE step, select Select an Existing WSDL File, then select the previously uploaded WSDL file, then click Next > and wait for file validation.

    Operation

  11. When the file is validated, click Next >.

    Operation

  12. On the options page, click Next >.

    Operation

  13. On the TARGET step, click Download List of Tables. Select the target database table, click the right arrow to move it to the Selected Tables list, then click Next >.

    Operation

  14. In the TARGET step, make sure that Insert/Update is selected, then click Finish.

    Operation

  15. In the Upsert Database transformation window, expand source and target trees, map fields by dragging and dropping, then click Save and close the transformation window.

    Operation

  16. In the Upsert Database operation window, click Save and close the window.

  17. In the Salesforce Outbound Message operation, double-click the Receive Salesforce Outbound Message activity.
  18. In the script window, edit the script to match the following, then click Save and close the window:

    <trans>
    $org.api.salesforce.request=$jitterbit.api.request.body;
    RunOperation("<TAG>Operations/Upsert Database</TAG>")
    </trans>
    
    Operation

  19. In the Salesforce Outbound Message operation window, click Save.

    Operation

  20. Select Actions > Deploy. In the Deploy dialog, under Select a Deploy Type, select Everything, then click Deploy.

    Operation

Part 3: API Manager API

  1. In API Manager, select My APIs, then click New API.
  2. In step 1 of the Publish New API page, enter values for the following, then click Next:

    • API Name: Enter a name for the API.
    • Environment: Select the environment where the Design Studio project was deployed to.
    • Service Root: Leave the initial value derived from the API name.
    • Version Number: (Optional) Enter an API version number.
    • Description: (Optional) Enter a description for this API.

    API

  3. In step 2, select Custom API as the Service Type and then click Add API Service. For the new API service, enter these values for the following fields, click Save, and then click Next:

    • Request Method: Use the menu to select the POST request method for the API service. By default, the request method is set to GET.

    • Service Name: Enter a service name.

    • In the Operation tab, select these values:

      • Assign Project: From the menu, select your Integration Studio project.

      • Assign Operation(s):

        • Operation: Selcect the Salesforce Outbound Message operation.

        • Response Type: Select Final Target as the response type.

    Part 3.2

  4. In step 3, click Skip This Step.

  5. In step 4, click Save & Publish.

    API

  6. In the dialog titled All Set, Your API is Live!, click Copy URL, then click Dismiss.

Part 4: Update Salesforce endpoint URL and activate

  1. In Salesforce, select Setup > Platform Tools > Process Automation > Workflow Actions > Outbound Messages.
  2. On the Outbound Messages page, click Edit for your outbound message.
  3. Replace the contents of Endpoint URL field (highlighted in the image below) with the URL copied at the end of the previous section, then click Save.

    Workflow rule

  4. In the Workflow Rules Using This Outbound Message section, click Activate for the rule (highlighted in the image below).

    Workflow rule

Test the integration

To test this integration design pattern, follow these steps:

  1. In Salesforce, open the Service app, and select the Accounts tab.
  2. Edit an account contact, then save it.
  3. Log into your database and query the target table.