Examine an Integration Use Case
After completing this unit, you’ll be able to:
- Describe the challenge of keeping new or updated closed-won opportunities in Salesforce in sync with sales orders in NetSuite.
- Explain how to use MuleSoft Composer to sync new or updated closed-won opportunities in Salesforce with sales orders in NetSuite.
- Prepare to create a flow.
Before You Start
This module builds on MuleSoft Composer Installation and Configuration, so make sure to complete 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.
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.
Let’s take a look at an integration challenge NTO is facing. Your sales team at NTO uses Sales Cloud to manage and maintain opportunities. Every opportunity goes through a series of stages in the sales process, from prospecting to proposal/price quote to closed won or lost. The sales team also uses NetSuite to create and fulfill sales orders, manage inventory, and track financials.
Currently, the sales team is performing these tasks manually. Every time an opportunity is successfully closed, a sales rep first marks the opportunity as closed won in Sales Cloud. Next, the rep creates a sales order in NetSuite using all relevant information associated with that opportunity such as product, price, and quantity. Finally, the rep updates the opportunity in Sales Cloud with the NetSuite sales order’s internal ID. This process is time-consuming and highly error-prone, so the team wants to automate it.
As a solution, you need to automate the integration between Sales Cloud and NetSuite in order to achieve near real-time integration. To do this, you use MuleSoft Composer to create an integration flow that automatically syncs new or updated closed-won opportunities in Salesforce with sales orders in NetSuite. Specifically, the flow must perform the following tasks.
- Find any new or updated closed-won opportunity in Sales Cloud.
- Fetch the account associated with the opportunity.
- Get all the opportunity products associated with the opportunity.
- Create a sales order for the account with all the opportunity products in NetSuite.
- Update the opportunity with the sales order’s internal ID in Sales Cloud.
In this use case, we assume that relevant primary data in Salesforce is synced with NetSuite. Specifically, we assume that:
- Every account in Salesforce has a corresponding customer in NetSuite, and the account’s NetSuite customer ID matches the customer’s internal ID. To learn how to perform this task, take Account-to-Customer Automation with MuleSoft Composer.
- Every product in Salesforce has a corresponding line item in NetSuite, and its product code matches the line item’s internal ID. To learn how to perform this task, take Product-to-Inventory-and-Assembly-Item Automation with MuleSoft Composer.
Note: To be able to view internal IDs in NetSuite, click Home | Set Preferences, select the Show Internal IDs checkbox, and then click Save.
Here’s an example of an account in Salesforce. Its NetSuite customer ID is 118178.
Here’s an example of the corresponding customer in NetSuite. Its internal ID, 118178, matches its associated account’s NetSuite customer ID in Salesforce.
Similarly, here are some example products in Salesforce. The product codes are 506, 507, 509, and 510.
Here are the corresponding line items in NetSuite. Their internal IDs are 506, 507, 509, and 510. These internal IDs match their associated product codes in Salesforce.
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.
NTO’s Sales Cloud
As a best practice, use a test environment for these systems and data when you design and test your flows. After you complete testing, run the flows using your production systems and data.
Next, you learn about the prerequisites for your Salesforce and NetSuite environments.
Prerequisites for the Salesforce Environment
First, we assume 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.
- Go to https://developer.salesforce.com/signup.
- Enter your contact information.
- Enter a unique username.
- Click Sign me up, and wait for your welcome email.
- 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 capture a NetSuite customer’s internal ID for a Salesforce account, ensure a text custom field called NetSuite Customer ID is created for the Account object in the NTO org. Here’s an example of NetSuite Customer ID for Account in the NTO org.
Finally, to capture a NetSuite sales order’s internal ID for a Salesforce opportunity, ensure a text custom field called NetSuite Order ID is created for the Opportunity object in the NTO org. Here’s an example of NetSuite Order ID for Opportunity in the NTO org.
To learn how to create custom fields, see Customize a Salesforce Object.
Prerequisite for the NetSuite Environment
MuleSoft Composer’s NetSuite connector enables NetSuite users with the administrator role to perform integration tasks between NetSuite and other MuleSoft Composer–supported systems. Before you use MuleSoft Composer to create a connection to NetSuite, ensure that your NetSuite user is assigned the NetSuite administrator role.
Now let’s find out values for a NetSuite connection.
NetSuite Connection Parameters
When you create a connection to NetSuite using MuleSoft Composer, you must specify values for the following parameters.
Connection Display Name
The connection display name is any name of your choice.
To find your NetSuite account, follow these steps.
- In NetSuite, click Setup | Integration | SOAP Web Services Preferences.
- Copy the account ID into a text file of your choice and save it.
Consumer Key and Consumer Secret
To generate a consumer key and consumer secret for a NetSuite connection, follow these steps.
- Click Setup | Company | Enable Features.
- Click SuiteCloud.
- Scroll down to the Manage Authentication section and select the Token-based Authentication checkbox.
- Click I Agree on the SuiteCloud Terms of Service page.
- Click Save.
- Click Setup | Integration | Manage Integrations | New.
- Configure your integration as follows, and then click Save to generate a consumer key and consumer secret.
- State: Enabled
- Token-based Authentication: selected
- TBA: Authorization Flow: deselected
- OAuth 2.0 Authorization Code Grant: deselected
- User Credentials: deselected
- Copy the consumer key and consumer secret into the text file and save it.
Token ID and Token Secret
To generate a token ID and token secret for a NetSuite connection, follow these steps.
- Click Setup | Users/Roles | Access Tokens | New.
- Configure the access token as follows, and then click Save to generate a token ID and token secret.
- Application Name:
- Token Name:
Composer Integration - [yourusername], Administrator
- Application Name:
- Copy the token ID and token secret into the same text file and save it. You use all the values in this text file when you configure a NetSuite connection using MuleSoft Composer.
You’ve taken the first steps to prepare to create your flow with MuleSoft Composer. In the next unit, you learn how to design your flow.