Design and Test a Flow
Learning Objectives
After completing this unit, you’ll be able to:
- Design a flow to automatically sync data from Salesforce to Google Sheets.
- Test your flow to ensure it syncs data as expected.
In this unit, you first learn how to use MuleSoft Composer to create a flow that automatically syncs campaign member data in Salesforce with Google Sheets. Then, you test your flow to ensure it syncs data as expected.
By default, MuleSoft Composer validates your work and provides contextual in-app help every step of the way. For example, when you add a connection to a system, MuleSoft Composer tests the connection to make sure it works before you can proceed to the next step. Also, to simplify building your flows, MuleSoft Composer prompts you to complete required fields within each step.
As a best practice, when building a flow, add a few steps and test iteratively until you complete the flow.
Take a look at this video demonstration showing how to connect Salesforce to Google Sheets using MuleSoft Composer.
Design a Flow
Now you’re ready to design an integration flow that automatically syncs campaign member data in Salesforce with Google Sheets.
Follow these steps to design a flow.
Launch MuleSoft Composer from the NTO org.
- Log in to your NTO org using your username and password.
- From the App Launcher, enter
Composer
and select MuleSoft Composer.
Create a new flow.
- Click Create New Flow.
- Click the pencil icon next to the default flow name.
- Name the flow
Sync NTO Org with Google Sheets
and click Save.
Create the trigger for the flow using the NTO org.
- Click Salesforce.
- Click Add new Salesforce connection to create a connection to the NTO sandbox org.
- Name the connection
NTO sandbox org
. - Select the checkbox This is a sandbox organization and click Create.
- Enter your NTO sandbox org’s username and password and click Log In.
- Click Allow to grant MuleSoft Composer the permissions to access your basic information, access and manage your data, and perform requests on your behalf at any time. MuleSoft Composer automatically tests the connection. If no error message appears, you have a successful connection, and the first step (trigger) of the flow appears.
- Click the pencil icon next to the default step name.
- Name the step
Get NTO data
and click Save.
Configure the trigger to start the flow every time a new campaign member is added to the NTO org.
- Click in the Choose an event that starts this flow field and select New record.
- Click in the Object Type field and enter
Campaign Member
. - Click Select Fields, select First Name, Last Name, Phone, Email, and Lead Source, and then click Add. You use these fields to perform integration in the next step of the flow.
- Click Save to save the flow.
Create the second step for the flow to sync NTO org data with Google Sheets.
- Click the plus icon to add a step.
- Click Google Sheets and then click Add New Google Sheets Connection.
- Name the connection
Marketing Event Tracker
and click Create. - Select the Google account in which the marketing event tracker resides.
- Click Allow three times to grant the three different permissions to MuleSoft Composer.
- Click Allow to grant MuleSoft Composer the permissions into your Google account. The second step of the flow appears.
Configure the second step to update the marketing event tracker.
- Name the step
Update marketing event tracker
and click Save. - Click in the Action field and select Create row.
- Click in the Spreadsheet Name field and select Marketing Event Tracker.
- In the Worksheet field, select Sheet1.
- Click Add Columns, select all fields, and click Add.
- Map the Campaign Member fields captured in step 1 of the flow to their corresponding fields in the marketing event tracker as follows.
- First Name = First Name from step 1
- Last Name = Last Name from step 1
- Email = Email from step 1
- Phone = Phone from step 1
- Lead Source = Lead Source from step 1
- Save the flow. Your entire flow should look like this.
Next, you learn how to test your flow.
Test a Flow
After you’ve designed your flow, you need to test it from end to end to ensure it syncs data as expected. In general, you have up to 10 minutes to complete a test. When the test completes or 10 minutes have passed, the test stops. As a best practice, you should get all required applications and data ready for the test before starting it.
In this use case, when a new campaign member is created in the NTO org, it triggers the flow. So be prepared to enter a campaign member in the NTO org. If the flow works as expected, that campaign member appears in the marketing event tracker in Google Sheets. So get ready to verify that the campaign member has been successfully added to the marketing event tracker.
Follow these steps to test a flow.
- In the Sync NTO Org with Google Sheets flow, click Test. The flow goes into a read-only mode.
Note: While the test is running, if for some reason you want to stop it, click Stop Test. - Log in to the NTO org’s Marketing Cloud Engagement, navigate to the All Active Campaigns tab page, and click User Conference.
- In the User Conference campaign, under Campaign Members click Add Contacts.
- Add a new contact with the following values, and then click Save.
- First name:
Jane
- Last name:
Doe
- Phone:
212-333-4444
- Email:
jane.doe@acme.com
- Lead Source:
Web
- First name:
- Click Next and then click Submit to add the contact to the User Conference campaign.
- Go back to your flow and wait for the test to complete. If the first step of the flow shows a green check mark and the second step shows no errors, this indicates the flow ran successfully. Take a look at the Test Output section and see the record values you entered for the test.
- Open your marketing event tracker in Google Sheets and verify the campaign member has been added.
- Repeat steps 1 through 7 to test another campaign member of your choice. Your flow should work as expected.
Good job! In the next unit, you learn how to activate, monitor, and troubleshoot your flow in the production environment.