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.
- 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. - Log in to ServiceNow using your username and password, and then click Start Building.
- In the Application Navigator, click Incidents, and then click New.
- Configure the new incident with the following values, and then click Submit.
- Short description:
Unable to perform daily backups
- Urgency: High
- State: New
- Short description:
- 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.
- Log in to the NTO org using your username and password.
- In the App Launcher, select Service to launch Service Cloud.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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
- Short description:
- 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.
- 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.
- 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.
- 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.