Test a Flow
Learning Objectives
After completing this unit, you’ll be able to:
- Prepare to test a flow.
- Test your flow to ensure it syncs new or updated contacts in Salesforce with customers in Square as expected.
Prepare to Test a Flow
After you’ve designed your flow, you must test it from end to end to ensure it syncs data as expected.
As a best practice, test your flow using your test systems and data. After you complete testing, run the flow using your production systems and data. For Salesforce, this means using a sandbox org to test your flow and a production org to run your flow.
Also, as a best practice, test every possible path of your flow. For example, if your flow has an If branch and an Else branch in an If/Else block, ensure to test both branches.
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 contact is created or updated in the NTO org, it triggers the flow. First, be prepared to log in to the NTO org as an end user and create a test contact.
Next, if a corresponding customer exists in Square, prepare to verify the following.
- The customer is updated with relevant contact details, including its associated contact ID, in Square.
- The contact is updated with its associated customer ID in Sales Cloud.
Finally, if a corresponding customer doesn’t exist in Square, prepare to verify the following.
- A customer is created with relevant contact details, including its associated contact ID, in Square.
- The contact is updated with its associated customer ID in Sales Cloud.
Test a Flow
Follow these steps to test a flow.
- In the Sync Salesforce Contacts to Square Customers flow, click Test. The flow goes into a read-only mode.
Note: While the test is running, if you want to stop it, click Stop Test. - Log in to the NTO org’s Sales Cloud as an end user and navigate to the Contacts tab page.
- Click New, create a contact with the following values, and then click Save.
- First Name:
Isabella
- Last Name:
Gonzales
- Mailing Street:
4012 1st Ave
- Mailing City:
Miami
- Mailing State/Province:
FL
- Mailing Zip/Postal Code:
33137
- Mailing Country:
US
- Phone:
305-234-9876
- Email:
isabella.gonzales@cloudkicks.com
- First Name:
- Go back to your flow and wait for the test to complete. If steps 1, 2, 5, and 6 show a green check mark, this indicates the flow ran successfully. The condition in the second If/Else block evaluates to true. This indicates the NTO contact doesn’t have a corresponding Square customer, so only the steps in the second If/Else block were executed. Take a look at the Test Output section and see the record values you entered for the test.
- Log in to Square Developer using your username and password, click Open on the Composer app, and then click Docs & Tools | API Explorer. The API Explorer tool opens.
- Click Select API | Customers, click Get Token, select Default Test Account on your Composer app, and then click Run in the cURL Request window to run the List customers endpoint. Verify a Square customer matching the NTO contact is created in the Response window. The customer should contain all relevant contact details, including a contact ID, which appears as a reference_id. In this example, it’s 0031U000026RhuNQAS.
- Return to the NTO org’s Sales Cloud, and verify the contact is updated with the Square customer ID. In this example, it’s N2DH7SCJFMX57AH9FNZC97GXJ0.
- In the Sync Salesforce Contacts to Square Customers flow, click Test again.
- In the NTO org’s Sales Cloud, update the contact with the following values, and then click Save.
- Mailing Street:
1001 Ocean Dr
- Mailing City:
Miami Beach
- Mailing Zip/Postal Code:
33139
- Phone:
305-555-6666
- Mailing Street:
- Go back to your flow and wait for the test to complete. If steps 1, 2, 3, and 4 show a green check mark, this indicates the flow ran successfully. The condition in the first If/Else block evaluates to true. This indicates the updating user is an end user, not the Composer user. Also, the triggering NTO contact has a corresponding Square customer, so only the steps in the first If/Else block were executed.
- Return to Square Developer and run the List customers (GET) endpoint. Verify that the customer is updated with the latest contact address and phone.
- Return to the NTO org’s Sales Cloud, and verify the contact is updated with the Square customer ID. In this example, it’s N2DH7SCJFMX57AH9FNZC97GXJ0.
- Repeat steps 1 through 12 to test another contact 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.