Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register 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 data from ServiceNow to Salesforce to Slack as expected.

In this unit, you first learn how to prepare to test a flow. Then, you learn how to test your flow to ensure it syncs incidents in ServiceNow with cases in Salesforce and notifications in Slack 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 flows using your test systems and data. After you’re done with testing, run the flows using your production systems and data. For Salesforce, this means using a sandbox org to test your flows and a production org to run your flows.

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 an incident is created or updated in ServiceNow, it triggers the flow. First, be prepared to create or update a test incident in ServiceNow. 

Next, if a corresponding case doesn’t exist in Service Cloud, prepare to verify the following.

  • A case with relevant incident details is created in Service Cloud.
  • The incident is updated with the Salesforce Case ID in ServiceNow.
  • A message about the new case shows up in the service-cases channel in Slack.

Finally, if a corresponding case exists in Service Cloud, prepare to verify the following.

  • The case is updated with relevant incident details in Service Cloud.
  • A message about the updated case appears in the service-cases channel in Slack.

Test a Flow

Follow these steps to test a flow.

  1. In the Sync Service Cases - ServiceNow to Salesforce to Slack 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
  2. Log in to ServiceNow using your username and password, and then click Start Building.
  3. In the Application Navigator, click Incidents, and then click New.
  4. Configure the new incident with the following values, and then click Submit.
    • Short description: Unable to perform daily backups
    • Urgency: High
    • State: New
  5. Go back to your flow and wait for the test to complete. If steps 1 through 5 of the flow show a green check mark, this indicates the flow ran successfully. 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 If branch with condition of list of cases is empty.Tested flow showing a green check mark on step 3 in If branch.Tested flow showing a green check mark on step 4 in If branch.Tested flow showing a green check mark on step 5 in If branch.Tested flow showing Else branch and no green check mark on step 6.Tested flow showing no green check mark on step 7.
  6. Log in to the NTO org using your username and password.
  7. In the App Launcher, select Service to launch Service Cloud.
  8. Click the Cases tab, select All Open Cases, and verify a corresponding case has been created in Service Cloud. Notice that the subject and status values come from step 3 of the flow.
    NTO org’s Service Cloud showing a new case corresponding to the ServiceNow incident.
  9. Click Unable to perform daily backups. In the Details section, notice that the ServiceNow Incident ID also comes from step 3 of the flow. In this case, the ServiceNow Incident ID is INC0010001.
    Service Cloud case showing associated ServiceNow incident ID.
  10. In ServiceNow, click the incident you created. Notice that the incident has been updated with the Salesforce Case ID. In this case, the Salesforce Case ID is 5001U00000s7iX5QAI.
    ServiceNow incident showing associated Salesforce Case ID.
  11. Open your NTO Slack workspace and verify the incident notification appears in the service-cases channel. Notice that because you used *New incident:* in your flow, it appears as New incident: in Slack.
    Slack service-cases channel showing a message with incident data from ServiceNow.
  12. Click Test on the flow again. This time, you’ll test an updated incident that has a corresponding case in Service Cloud, thus using the Else block of your flow.
  13. In ServiceNow, open the incident you created above, configure it with the following values, and then click Update.
    • Short description: Unable to perform daily backups - ESCALATED
    • State: In Progress
  14. Go back to your flow and wait for the test to complete. If steps 1, 2, 6, and 7 of the flow show a green check mark, this indicates the flow ran successfully. This is because the case exists in Service Cloud, and only the steps in the Else branch 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 If branch with condition of list of cases is empty.Tested flow showing no green check mark on step 3 in If branch.Tested flow showing no green check mark on step 4 in If branch.Tested flow showing no green check mark on step 5 in If branch.Tested flow showing Else branch and a green check mark on step 6.Tested flow showing a green check mark on step 7.
  15. In Service Cloud, select All Open Cases, and verify the case that was created in the previous test has been updated. Notice that the subject and status values come from step 6 of the flow.
    NTO org’s Service Cloud showing the updated case corresponding to the updated ServiceNow incident.
  16. Open your NTO Slack workspace and verify the incident notification appears in the service-cases channel. Notice that because you used *Updated incident:* in your flow, it appears as Updated incident: in Slack.
    Slack service-cases channel showing a message with updated incident data from ServiceNow.
  17. Repeat steps 1 through 16 to test another incident 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