Skip to main content

Examine an Integration Use Case

Learning Objectives 

After completing this unit, you’ll be able to:

  • Describe the challenge of keeping new or updated accounts in sync between two Salesforce orgs and Slack.
  • Explain how to use MuleSoft Composer to sync new or updated accounts between two Salesforce orgs and Slack.
  • Prepare to create a flow.

Before You Start

This module builds on MuleSoft Composer Installation and Configuration, so make sure you’ve completed it before you continue. Recall from that module, you need to have the MuleSoft Composer User permission set if you want to build and run integration flows.

In this module, we assume you’re an authorized MuleSoft Composer user. If you’re not a MuleSoft Composer user, that’s OK. Read along to learn how they perform the steps. Don’t try to follow the steps in a Trailhead Playground, because MuleSoft Composer isn't available in the Trailhead Playground.

Note

To learn about MuleSoft Composer’s integration features, flow components, and flow creation tasks, take MuleSoft Composer Basics.

In this unit, you step into the role of admin for Northern Trail Outfitters (NTO), an outdoor and recreational gear retailer. First, you examine an integration challenge faced by NTO, and then you learn about a MuleSoft Composer integration solution. Finally, you learn how to prepare to create your flow.

Integration Challenge

Let’s take a look at an integration challenge NTO is facing. NTO recently acquired Great Divide (GD), a mountain climbing equipment retailer. NTO and GD are long-time Salesforce users. GD operates as a separate division and stores its accounts in its own GD org. Your sales teams at both GD and NTO need to sync new or updated accounts in the GD org with the NTO org to maintain visibility across both.

Currently, the sales teams at GD and NTO perform these tasks manually. Every time there’s a new or updated account, a GD rep first creates or updates the account with relevant details in the GD org, and then sends an email to the NTO team about the account. Next, an NTO rep determines if a corresponding account exists in the NTO org.

  • If the account doesn’t exist, the rep creates a new account with associated details in the NTO org.
  • If the account exists, the rep updates the account with relevant details in the NTO org.

This process is time-consuming and highly error-prone, so the teams want to automate it.

Integration Solution

As a solution, you need to automate the integration between the GD and NTO orgs and Slack to achieve near real-time integration. To do this, you use MuleSoft Composer to create an integration flow that automatically syncs new or updated accounts between the GD and NTO orgs and Slack. Specifically, the flow must perform the following tasks.

  1. Find any new or updated account in the GD org.
  2. Determine if a corresponding account exists in the NTO org.
  3. If the account doesn’t exist in the NTO org:
    1. Create an account with relevant details, including its associated GD account ID.
    2. Update the GD account with its associated NTO account ID.
    3. Post a message with relevant account details to the predefined Slack channel.
  4. If the account exists in the NTO org:
    1. Update the account with relevant details, including its associated GD account ID.
    2. Update the GD account with its associated NTO account ID.
    3. Post a message with relevant account details to the predefined Slack channel.

To implement the solution using MuleSoft Composer, you perform these flow creation tasks.

  • Prepare to create a flow.
  • Design and test a flow.
  • Activate a flow.
  • Monitor and troubleshoot a flow.

You learn how to perform these tasks in the rest of this module.

Prepare to Create a Flow

Ready to get started?

First, gather all required information about the systems and assets your flow is going to use. The following table describes the systems the flow needs to connect to and the information you need for those systems.

System Required Information

NTO’s Sales Cloud

  • URLs of the NTO sandbox and production orgs
  • Username and password with appropriate permissions to the NTO orgs

GD’s Sales Cloud

  • URLs of the GD sandbox and production orgs
  • Username and password with appropriate permissions to the GD orgs

Slack

  • Workspace
  • Channel
  • User ID and password with appropriate permissions

As a best practice, use a test environment for these systems and data when you design and test your flows. After you’re done with testing, run the flows using your production systems and data.

Next, you learn about the prerequisites for your Salesforce and Slack environments.

Prerequisites for the Salesforce Environment

First, it’s assumed that you have a sandbox org and a production org to build and run flows that sync with Salesforce. 

Note: If you don’t have a sandbox org to design and test your flows, you can use a developer org.

Follow these steps to sign up for a free developer org.

  1. Go to https://developer.salesforce.com/signup.
  2. Enter your contact information.
  3. Enter a unique username.
  4. Click Sign me up, and wait for your welcome email.
  5. In the welcome email, click the link to set your password.

Next, when you create a connection to Salesforce using MuleSoft Composer, you’re prompted to grant MuleSoft Composer permissions. Ensure your Salesforce accounts for both your sandbox and production orgs are ready to grant MuleSoft Composer the following permissions.

  • Access the identity URL service.
  • Manage user data via APIs.
  • Perform requests at any time.

Then, to cross-reference the accounts between the GD and NTO orgs, ensure a custom field, NTO Account ID, is created for the Account object in the GD org. Here’s an example of NTO Account ID in the GD org. 

GD Account object with custom field NTO Account ID.

Also ensure a custom field, GD Account ID, is created for the Account object in the NTO org. Here’s an example of GD Account ID in the NTO org.

NTO Account object with custom field GD Account ID.

To learn how to create custom fields, see Customize a Salesforce Object.

Next, it’s critical that you use two different users for the GD sandbox org and the GD production org. These orgs are the source orgs of the integration.

  • One user is used exclusively by the GD org connection to perform the associated create or update steps in your flow. Let’s call this the Composer user from now on.
  • The other user is an end user who creates or updates data in the GD org at runtime.

With this separation of duties, you perform the first of two tasks to avoid the problem of infinite looping when running your flow. This problem occurs when you use a GD user to perform the update steps on the GD org in your flow, and then use that same user to update data in the GD org at runtime.

To learn how to create users in Salesforce, see User Management.

The second task to avoid the problem of infinite looping is to ensure in your flow that the user performing the update in the GD org at runtime isn’t the Composer user. To do this, identify the Salesforce ID of the Composer user so that you can configure the relevant steps in your flow. Follow these steps.

  1. Log in to your GD org using the username and password of the Composer user.
  2. From the App Launcher, enter People and select People.
  3. Click the name of the Composer user.
    URL of Composer user with Salesforce ID.
  4. Look at the URL. The Salesforce ID of the user appears near the end of the URL. In this example, it’s 0055A000008sCOOQA2. You use this Salesforce ID later in your flow.

Prerequisites for the Slack Environment

To post notifications about new or updated accounts to a predefined Slack channel, you need a Slack workspace and channel. Follow these steps to create a Slack workspace and channel.

  1. Access slack.com, click LAUNCH SLACK, and then select Create a new workspace.
  2. Enter your email address and click Continue.
  3. Check your email for a confirmation code sent by Slack and enter it in Slack.
  4. Enter NTO as the name of your company, and click Next. Your workspace is NTO.
  5. Enter account-automation as the project your team is working on, and click Next. Your channel is account-automation.
  6. When prompted to add people, click Skip this step, click Skip Step, and then click Let’s Go to go straight to your workspace and channel.
    Slack sidebar with account-automation channel highlighted.

When you create a connection to Slack using MuleSoft Composer, you’re prompted to grant MuleSoft Composer permissions. Be ready to grant MuleSoft Composer the following permissions to your Slack workspace.

  • View content and info about channels and conversations.
  • View content and info about your workspace.
  • Perform actions in channels and conversations.

You’ve taken the first steps to prepare to create a flow with MuleSoft Composer. In the next unit, you learn how to design a flow.

Resources 

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback