App Connect

 View Only

Using IBM® App Connect to interact with Salesforce

By Shahmini Arumugam posted Tue February 14, 2023 10:21 PM

  

Co-author – Srihari Ananda Kumar 


Salesforce provides customer relationship management (CRM) software services to help you manage interactions with your customers and prospects.

Building a flow in IBM App Connect with Salesforce

Use App Connect to build flows that integrate with Salesforce and other applications. The connector is displayed as Salesforce on the App Connect User Interface (UI). 

To allow App Connect to connect to your Salesforce account, you need to fill in the connection fields that you see in the App Connect Designer Catalog page or flow editor.

For more information on connection fields, see How to use App Connect with Salesforce.


Salesforce objects

The following are the Salesforce objects that can be run in App Connect.

Objects

Description

Accounts

Use accounts to save information about the customers you do business with or who are your clients.

Attachments

An attachment record in Salesforce is a record of the Attachment Object which is then associated with a parent record.

Campaigns

A Salesforce campaign is a group of leads and contacts who have been provided with specific marketing communications.

Cases

Cases are a Salesforce tool that is used to interact with customers to solve their problems.

Contacts

Use contacts to store information about the customers you do business with or who are your clients.

Content documents

Content document represents the link between a Salesforce file or Document object in Salesforce and where it's shared.

Custom SOQL

A customized SOQL statement that can include complex queries.

Events

Events are a Salesforce tool that is used for customer relationships and closing deals.

*The Salesforce standard objects and user-defined custom objects can be viewed by expanding the Show more option from the object list once you have connected App Connect to your Salesforce account.

Scenario 1: Retrieve records for campaigns and their members from Salesforce and update the rows of the Microsoft Excel Online worksheet with campaign details

Consider this scenario: A campaign-related information is queried from Salesforce for a specified year, and these details are then appended to a Microsoft Excel Online worksheet with the specified campaign information. A slack message gets sent to the intended channel.

In this flow:

  1. You run a scheduler-based flow that runs a custom SOQL query in Salesforce.

    Note: You can use the Retrieve operations on Salesforce standard objects to retrieve simple queries, for example, the Retrieve campaign operation. However, if you need to run complex queries, use the Custom SQL object. For more information, see the section Events and actions on the How to use App Connect with Salesforce documentation.

  2. The Execute custom SOQL operation runs the following SOQL query in Salesforce to retrieve the campaign and campaign member details for the current year.

    Upon running your custom query, you can check the response of the query. You must be familiar with the object's schema, as the response is an abstract object type.

    Tips:

    You can do a test run for the query to identify the schema. You can then use the corresponding fields that are extracted from the response in the flow.

  3. A For each node operation is added to check each of the Salesforce campaign records that have been retrieved.
  4. A Set variable node is added to the conditional statement node to set a variable for each campaign member record.

    For example, a variable (Records) is defined for each of the campaign and opportunity records retrieved from Salesforce.

  5. A For each conditional statement node is added to process each of the Records

    In this example, the object Records is used, and the corresponding fields, which were extracted from the query, are then mapped to the Microsoft Excel Online worksheet columns.



  6. The campaign records are added to the columns of the Microsoft Excel Online worksheet by using the Append row operation based on the Columns

    Note: Members of all campaigns can be retrieved, even if a member is part of multiple campaigns. Each member of the campaign is added to the worksheet.

    For example, the following columns are mapped with the retrieved campaign records into a workbook Salesforce_CampaignRecords on worksheet A.




    A new row is appended in the Microsoft Excel Online worksheet A with the campaign records retrieved from Salesforce.

    For example:

    The worksheet A has the following campaign members:

    Two new leads are added to the Campaign Members table in Salesforce.

    The new leads are now appended to worksheet A rows 11 and 12.

  7. A Slack message gets sent to the intended channel. This message is sent to notify you that a campaign record has been added.



Scenario 2: Create a platform event in Salesforce whenever a product is created or updated in Microsoft Dynamics 365 for Sales 

Consider this scenario: A platform event is created when a product is created or updated in Microsoft Dynamics 365 for Sales. In this example, a custom platform event, Covid vaccination Pune and Mumbai are created in Salesforce with the vaccination details. When the product, covid vaccination details are created or updated in Microsoft Dynamics 365 for Sales, the platform event is published in Salesforce.

We have defined the Salesforce platform event definition in Salesforce. In this example, the create operation is used to publish the platform events.

Ø  Salesforce action operations: Create Covid vaccination Pune and Create Covid vaccination Mumbai

In this flow, the Create operations publish the messages in real time to the Salesforce topics.

Tips: The event messages are published by publishers and are delivered in real-time to subscribers. You must define the platform event fields to customize the published data. Platform events are part of Salesforce's enterprise messaging platform. For more information, see Defining Your Custom Platform Event.

Tips:

The event messages are published by publishers and are delivered in real-time to subscribers. You must define the platform event fields to customize the published data. Platform events are part of Salesforce's enterprise messaging platform. For more information, see Defining Your Custom Platform Event.

In this flow:

  1. The event-driven flow is triggered whenever a product is created or updated in Microsoft Dynamics 365 for Sales.
  2. An If and Else conditional node is added to the flow where Microsoft Dynamics 365 for Sales checks for the following conditions:

    Ø  Quantity on hand specifies the stock quantity.

    Ø  Name, which specifies the name of the vaccine.

    Ø  Description, which specifies the location of the vaccination availability.

    For example:

      1. If the Quantity on hand is greater than 0, Name equals to Covishield vaccine and Description equals Pune, a platform event is created by the Salesforce Create covid vaccination Pune operation with the vaccine details. 
      1. If the Quantity on hand is greater than 0, Name equals to Covishield vaccine and Description equals Mumbai, a platform event is created by the Salesforce Create covid vaccination Mumbai operation with the vaccine details.

        For example:
      2. For each request, a Slack message gets sent to the intended channel. This message is sent to notify the stock details of the vaccine.
        For example:


  3. Else, if the specified conditions are not met, a Slack message gets sent to the intended channel. This message is sent to notify you that the stock is for another location.

    For example:

    Scenario 3: Send a Gmail message when a platform event is triggered

    Consider this sequel scenario: A Gmail message gets sent to the subscribers of the platform event when the event is published.

    We have defined the Salesforce platform event definition in Salesforce. In this example, the new operation is used to publish the platform events.

    Ø  Salesforce event operations: New covid vaccination Pune and New covid vaccination Mumbai

    This flow is an event-driven flow, which will be triggered whenever a subscription event occurs.

    The Salesforce custom platform event in this example is either the Covid vaccination in Pune or Mumbai. You can select the platform event based on the Covid vaccination location, either Pune or Mumbai.

    In this example, the flow is triggered by the New covid vaccination Mumbai operation. Whenever a covid vaccination Mumbai event is published by a publisher, a Gmail message gets sent to the subscribers with the vaccination details.

    In conclusion, platform event messages are published by publishers and delivered in real time to subscribers, as described in scenarios 2 and 3.

    Scenario 4: Create a lead in Insightly and store the details in Amazon DynamoDB whenever a new lead is created in Salesforce

    Consider this scenario: A lead is created with the lead’s details in Insightly, and the information of the lead is stored in Amazon DynamoDB with the created and last modified timestamp records whenever a new lead is created in Salesforce.

    In this example, the flow is triggered by a Change Data Capture (CDC) event, New lead (Change Data Capture) operation.

    Note:

    Ensure that you have created and enabled the relevant CDC event operations in the Salesforce endpoint. For more information, see [Select Objects for Change Notifications]( https://developer.salesforce.com/docs/atlas.en-us.224.0.change_data_capture.meta/change_data_capture/cdc_select_objects.htm).

    Tips

    §  Change Data Capture (CDC) publishes change events that indicate Salesforce record modification. For more information, see What is Salesforce Change Data Capture (CDC).

    §  Change events are available for all custom objects that are defined in your Salesforce and a subset of standard objects. For more information, see [Change Event Object Support ](https://developer.salesforce.com/docs/atlas.en-us.224.0.change_data_capture.meta/change_data_capture/cdc_object_support.htm).

    In this flow:

    1. The Change Data Capture (CDC) event-driven flow is triggered whenever a lead is created in Salesforce.
    2. For each Salesforce record ID, it retrieves the lead IDs from Salesforce.
    3. For each Salesforce lead,
      1. A new lead is created in Insightly with the lead details.
      2. The lead details are also added to Amazon DynamoDB by using the Update or create item operation based on the lead ID. In Amazon DynamoDB, the lead will have the created and last modified timestamp records.
      3. Salesforce then updates its records with the Insightly lead’s ID.
      4. A Slack message gets sent to the intended channel to notify them that the lead has been added to Insightly and Amazon DynamoDB.



    Scenario 5: Update lead in Insightly and store the updated details in Amazon DynamoDB whenever a lead is updated in Salesforce.

    Consider this squeal scenario: The lead (or its details) is updated in Insightly, and the relevant information is updated in Amazon DynamoDB whenever an existing lead is updated in Salesforce. In Amazon DynamoDB, the lead will have the created and last modified timestamp records. A Slack message gets sent to the intended channel.

    In this example, the flow is triggered by a Change Data Capture (CDC) event, Updated lead (Change Data Capture) operation.

    In this flow:

    1.     The event-driven flow is triggered whenever a lead is updated in Salesforce.

    2.     For each Salesforce record ID, it retrieves the lead IDs from Salesforce.

    3.     For each Salesforce lead,

    1. The lead (or its details) is updated in Insightly and Amazon DynamoDB. In Amazon DynamoDB, the lead will have the created and last modified timestamp records.
    2.  A Slack message gets sent to the intended channel to notify them that the lead has been updated in Insightly and Amazon DynamoDB.

    In conclusion, Salesforce lead details are created or updated in Insightly and Amazon DynamoDB when a lead is either created or updated in Salesforce, as described in scenarios 4 and 5.

    Resources

    Try out our templates

    You can view the Templates gallery in your App Connect Designer instance.

    The following use cases are available in the Templates gallery on App Connect Designer.

    • Retrieve records for campaigns and their members from Salesforce and update the rows of the Microsoft Excel Online worksheet with campaign details
      Template URL: https://<your-instance-id>/templates/Retrieve%20records%20for%20campaigns%20and%20their%20members%20from%20Salesforce%20and%20update%20the%20rows%20of%20the%20Microsoft%20Excel%20Online%20worksheet%20with%20campaign%20details

      §  Create a platform event in Salesforce whenever a product is created or updated in Microsoft Dynamics 365 for Sales

      Template URL: https://<your-instance-id>/templates/ Create%20a%20platform%20event%20in%20Salesforce%20whenever%20a%20product%20is%20created%20or%20updated%20in%20Microsoft%20Dynamics%20365%20for%20Sales

      §  Send a Gmail message when a platform event is triggered

      Template URL: https://<your-instance-id>/templates/Send%20a%20Gmail%20message%20when%20a%20platform%20event%20is%20triggered

      §  Store lead is detailed in Insightly and Amazon DynamoDB whenever a new lead is created in Salesforce

      Template URL: https://<your-instance-id>/templates/Store%20lead%20details%20in%20Insightly%20and%20Amazon%20DynamoDB%20whenever%20a%20new%20lead%20is%20created%20in%20Salesforce

      §  Store lead details in Insightly and Amazon DynamoDB whenever a lead is updated in Salesforce

      Template URL: https://<your-instance-id>/templates/Store%20lead%20details%20in%20Insightly%20and%20Amazon%20DynamoDB%20whenever%20a%20lead%20is%20updated%20in%20Salesforce

    You must enable the Designer AI features in your containerized environment in order to access the App Connect templates. For more information, see The preloaded IBM App Connect templates.

    You can also import these use cases directly into your App Connect Designer. These templates are added to a public GitHub repository at https://github.com/ot4i/app-connect-templates/tree/cp4i-templates/resources.

    0 comments
    31 views

    Permalink