Skip to main content
Dreamforce is streaming for free on Salesforce+. Watch now.

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.

  1. 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.
  2. Log in to the NTO org’s Sales Cloud as an end user and navigate to the Contacts tab page.
  3. 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
  4. 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.
    Tested flow showing a green check mark on step 1.Tested flow showing a green check mark on step 2.Tested flow showing the first If/Else block within the For Each block.Tested flow showing step 3 in the first If/Else block.Tested flow showing the rest of step 3 in the first If/Else block.Tested flow showing step 4 in the first If/Else block.Tested flow showing a blue border around the second If/Else block.Tested flow showing a blue border and a green check mark on step 5 in the second If/Else block.Tested flow showing a blue border around the rest of step 5 in the second If/Else block.Tested flow showing a blue border and a green check mark on step 6 in the second If/Else block.
  5. 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.
  6. 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.
    Response window showing Square customer with the contact ID as a reference_id.
  7. 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.
    NTO contact with Square customer ID.
  8. In the Sync Salesforce Contacts to Square Customers flow, click Test again.
  9. 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
  10. 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.
    Tested flow showing a green check mark on step 1.Tested flow showing a green check mark on step 2.Tested flow showing a blue border around the first If/Else block within the For Each block.Tested flow showing a blue border and a green check mark on step 3 in the first If/Else block.Tested flow showing the rest of step 3 in the first If/Else block.Tested flow showing a blue border around and a green check mark on step 4 in the first If/Else block.Tested flow showing the second If/Else block.Tested flow showing step 5 in the second If/Else block.Tested flow showing the rest of step 5 in the second If/Else block.Tested flow showing step 6 in the second If/Else block.
  11. Return to Square Developer and run the List customers (GET) endpoint. Verify that the customer is updated with the latest contact address and phone.
    Square customer with updated address and phone.
  12. 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.
    NTO contact with Square customer ID.
  13. 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.

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