Contents


Trigger a sales lead flow from Salesforce CRM to a Google spreadsheet using App Connect Professional

A no-code approach to build a project flow between App Connect and API Connect for the enterprise

Comments

When your company's marketing and sales teams gather leads, they need to ensure accurate contact information and details throughout the sales cycle. To start, the sales lead information is entered into their sales management software, such as Salesforce CRM. As other departments need access to this data for reporting purposes, sales teams might resort to manually adding this data into a spreadsheet. This manual practice is time-consuming and prone to human error that can ultimately create confusion about the lead or even cause the team to lose the lead or the company to lose a sale. To automate this process, you can create a data flow from Salesforce CRM to a spreadsheet tool, such as Google Sheets.

This tutorial demonstrates how to build this type of end-to-end flow by using the IBM® App Connect and IBM API Connect offerings. To begin, you build a project in App Connect Professional and publish it as a REST API in API Connect. Then, you build a flow in App Connect Personal to trigger a flow to a worksheet in Google Sheets from Salesforce. Finally, you test the project. By following the steps in this tutorial, you can apply this approach to other manual processes in your enterprise.

What you'll need to build your application

To complete the steps in this tutorial, you need:

Sales lead use case

As part of his sales team's quarterly roll-up, Matt, a sales manager, must consolidate the leads (and their essential details) that his team generates into a Google spreadsheet. He and his team don't have much experience in Salesforce CRM and are concerned about manually adding each record to the spreadsheet when a new lead is entered into Salesforce CRM. Matt wants a simple solution to help his team automatically add an entry to a Google spreadsheet when a lead is added to an account in Salesforce.

Matt seeks the help of Rob, an integration developer. Rob helps Matt automate the flow of a sales lead from Salesforce to Google Sheets by using App Connect Professional and API Connect. He develops an orchestration (flow) in App Connect Professional to create a lead record in Salesforce. Rob then publishes the project to API Connect to expose it as an API. The published API in API Connect is consumed in an application that is developed by an app developer. By using this application, Matt can provide the details of each lead from a mobile or web application. The API internally traverses the details that are entered to the running orchestration in App Connect Professional or API Connect, creating a record in Salesforce.

Rob also configures IBM App Connect Personal to add an entry with the relevant details to a Google spreadsheet.

This use case follows these high-level steps:

  1. Create a project in App Connect Professional Studio. When this project is triggered, a lead is created in Salesforce.
  2. Publish the project to API Connect to expose it as an REST API. Then, expose the REST API as a mobile or web application. When this API is exposed, a user can provide lead data, such as the name and company name of the contact.
  3. In App Connect Personal, create a flow with Salesforce as a trigger and a Google worksheet as the action. When a lead is created in Salesforce, the corresponding entry is added to the worksheet.
  4. Enter the contact information for the lead in Salesforce by using the application. When you enter the information into the application, the project is triggered from API Connect to App Connect Professional to create the lead in Salesforce. At the same time, the flow from Salesforce to the Google worksheet is triggered in App Connect Personal to create an entry in the Google worksheet.
1

Build the project on IBM App Connect Professional

Log in to IBM App Connect Professional with your IBMid. Then, create a new project, and edit it.

App Connect Professional Studio then opens, showing the orchestration. The following figure shows the orchestration for the use case in this tutorial as described in the previous section.

App connect professional Studio orchestration
App connect professional Studio orchestration

The HTTP Connector-Receive Request activity, which receives the request data, triggers the flow. The received input data, which is in JSON format, is passed to the Read JSON activity. The output of the READ JSON activity is passed as input data to the Create Objects activity of the Salesforce connector.

The following example shows the Request JSON that is sent:

{
"objects": {
"Lead": {
 "LastName": "Andy",
"Company": "Andy Enterprises"
 }
}
}

The response Id and success response are sent as JSON to the user of the Write JSON and Send Response activity of HTTP Connector. The user input is mapped to the Salesforce Create Objects activity of the lead object.

To ensure that the orchestration is valid, click Orchestration → Validate. The "Orchestration is valid" message is displayed.

A lead is then created on the Salesforce CRM, and a response is sent back to the API. The following example shows the response JSON that is received by the Send Response activity:

{
"results": {
"result": {
"id": "00Q2800000aFGwqEAG",
"success": "true"
}
}
}

To design the orchestration to create an end-to-end flow:

  1. On the Configuration tab of HTTP Receive Request activity, enter the Request JSON and Response JSON (Figure 2). Then, click Generate Swagger. Request and Response JSON to generate Swagger
    Request and Response JSON to generate Swagger
  2. Optional: Click Download Swagger to view the output for reference. Download Swagger
    Download Swagger
2

Publish the project to App Connect and push it as a REST API to API Connect

After you generate Swagger and verify that the orchestration flow is valid, push the flow as a REST API to IBM API Connect:

  1. Click Save to save the project to the cloud.
  2. Start the orchestration.
  3. Under Configuration details, click the Push the Project to API Connect link. Publish to API Connect                  button
    Publish to API Connect button
  4. In the Push to API Connect window, under Authentication, enter your IBMid credentials for User ID and Password. Then, click Load Organizations.
  5. For the Organizations option, select a defined organization, and then click Push to APIM to push the orchestration to API Connect. Push to API Connect window
    Push to API Connect window
  6. In the Please wait window, click OK.  Publishing the API
    Publishing the API
3

Develop a flow on App Connect Personal to initiate the flow

While you are waiting for the API to publish to API Connect, you can create a flow in IBM App Connect Personal. In this tutorial, you create a flow to automatically add an entry to a Google worksheet when a lead is created in Salesforce. For a demonstration of these steps, watch this video.

To create a flow in App Connect Personal:

  1. Go to the IBM App Connect Personal page.
  2. If you are registered to use App Connect Personal, log in to App Connect Personal Designer. Click Log in, and sign on with your IBMid. If you are not registered, click Sign up. After you login, you see the App Connect Personal Dashboard. App Connect Personal, Focus on what really matters
    App Connect Personal, Focus on what really matters
  3. On the App Connect Personal Dashboard page, click the Applications tab. A list of endpoints or enterprise applications is displayed.
  4. Select the trigger and action applications that you want to use. In our use case, the trigger application is Salesforce CRM, and the action application is Google Sheets.
    1. Click Salesforce to expand it, and then click Connect to Salesforce to connect to your user account.
    2. On the Salesforce login page, enter your user name and password for your Salesforce account.
    3. On the Allow access page, allow access for IBM App Connect to use or modify your Salesforce account data.
    4. On the Applications tab in App Connect Personal, click Google Sheets to expand it, and then click Connect to Google Sheets.
    5. On the Google Sheets application page, click Connect your Google Sheets accounts.
    6. On the next Google page, enter your user name and password to authenticate your Google account.
    7. Allow access for App Connect to use your Google Sheets data.
    Choose the endpoints from the application library
    Choose the endpoints from the application library

    You have now defined the trigger and action applications.

  5. Create a flow in App Connect Personal:
    1. Click Dashboard.
    2. Click the New icon, and then click Create an event-driven flow.
    3. Under the plus symbol (+) on the left center of the page, define how you want to start the flow. To begin, from the application list, you select the trigger for the flow, which is Salesforce in this example.
      1. Expand Salesforce.
      2. Select the trigger object, which is New Lead in this example. The object is added to the trigger Salesforce. Object added to the trigger
        Object added to the trigger
      3. From the Applications list, under What do you want to add?, add an application. In this example, expand Google Sheets.
      4. Select the actions. For Google Sheets, click Create a Row.
      5. Select the Spreadsheet and Worksheet. Then, select the row headers of the worksheet for the Google Sheets account. Enter the essential details to map them from the Salesforce fields.

        Alternatively, you can click Auto Match Fields to automatically map the fields from Salesforce to Google Sheets. This option is specific to a flow from Salesforce to Salesforce and can help map related fields, such as first name, last name, address, and phone number.

      6. Click a field, for example Row (A). Then, click Insert a Reference. From the list of Salesforce fields, select one or more fields. Then, click Insert a Function to add functions to the fields to achieve the field mapping that you need.
    apping Salesforce values as input to action
    apping Salesforce values as input to action
  6. Enter a name for the flow, and then activate the flow.

For more detailed steps, see the tutorial section of App Connect Personal Documentation.

4

Test the project

Test the flow of your API to ensure that it creates a record in Salesforce and at the same time, adds an entry gets to the Google worksheet for the created sales lead record:

  1. In API Connect, click the APIs tab to view the published API. APIs tab showing the published project
    APIs tab showing the published project
  2. Click the target API that goes to the API page. Design, Source, and Assemble tabs on the APIs                 page
    Design, Source, and Assemble tabs on the APIs page
  3. On the Assemble tab of the target API, click Create assembly. Assemble tab in API                     Connect
    Assemble tab in API Connect
  4. Under Policies, drag the Invoke policy from the left navigation pane to the right pane. Drag and drop policies
    Drag and drop policies
  5. Click the Invoke policy. In the right pane, enter the target URL. Below the URL, enter your user name and password (not shown), which are your IBMid credentials of the tenant in the App Connect Professional cloud where the orchestration is published and running. API details
    API details
  6. Click the solid arrow icon next to the Search field to test the flow. Testing the flow
    Testing the flow
  7. Select the existing catalog.
  8. Create a product in the existing setup, and then click Create and publish. Click Next. Create a new product
  9. In the Test panel, from the list of operations, select the operation for your requirements. In this example, select the post operation. Test panel showing the list of operations
  10. Click Generate. Generate button
  11. To verify the published API, click Invoke. Invoke the API

You now see the output, which in this case shows that the lead is created in the Salesforce account.

Test response

You can also see that the orchestration that receives the request in App Connect Professional cloud and that the job completed successfully.

Orchestration in App Connect Professional with the                 jobs
Orchestration in App Connect Professional with the jobs

You also see now that an entry is added to Google Sheets Sheet1 of the selected spreadsheet from App Connect Personal.

Google Sheets with added flow entries
Google Sheets with added flow entries

Conclusion

In this tutorial, you learned about a no-code approach to automatically flow a sales lead that is created in Salesforce to a spreadsheet in Google Sheets by using App Connect Professional, App Connect Personal, and API Connect. This approach entailed developing an orchestration or project in App Connect Professional and then deploying it as an API to API Connect to provide a flow trigger for App Connect Personal. Now that you are familiar with the trigger and target applications that are available with App Connect, you can see how you can apply the process in this tutorial to other manual tasks in your enterprise.

Acknowledgment

The authors thank Ramya Rajendiran and Hariharan I. Subramanian for reviewing this tutorial and providing their valuable feedback.


Downloadable resources


Related topics


Comments

Sign in or register to add and subscribe to comments.

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Middleware, Cloud computing
ArticleID=1045995
ArticleTitle=Trigger a sales lead flow from Salesforce CRM to a Google spreadsheet using App Connect Professional
publish-date=05222017