Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.

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 Slack.
  • 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 integrates customer service cases in Salesforce with case notifications in Slack. Then, you test your flow to ensure it integrates 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. 

Note

If you have a large integration task, it’s recommended that you break up the task into manageable, bite-sized chunks, and then create a flow for each chunk. This enables you to more easily and quickly build, test, and run your flows to accomplish the task.

Take a look at this video demonstration showing how to connect Salesforce to Slack using MuleSoft Composer.

Design a Flow with Trailhead Simulator

Now you’re ready to design an integration flow that integrates customer service cases in Salesforce with case notifications in Slack. Want to give it a try? You can use Trailhead Simulator to practice designing a flow.

Note

The Trailhead Simulator is not a Trailhead Playground. It provides a simulated experience and does not store your progress. If you close and relaunch the simulation, it restarts. You can use the navigation controls to return to where you left off. For the best experience, view the Trailhead Simulator on a computer, not a mobile device. Also, note that the Trailhead Simulator is designed to show a focus box on the correct click area if you click the wrong area first. To continue, simply click the focus area.

Follow these steps to design a flow.

Launch MuleSoft Composer from the NTO org.

  1. Launch the Trailhead Simulator, and on the title screen, click Begin.
  2. Log in to your NTO org using your username and password.
  3. From the App Launcher, enter Composer and select MuleSoft Composer.

Create a new flow.

  1. Click Create New Flow.
  2. Click the pencil icon next to the default flow name.
  3. Name the flow Sync NTO Service Cases with Slack and click Save.

Create a trigger for the flow using the NTO org.

  1. Click Salesforce.
  2. Name the connection NTO sandbox org.
  3. Select the checkbox This is a sandbox organization and click Create.
  4. Enter your NTO sandbox org’s username and password and click Log In to Sandbox.
  5. Click Allow to grant MuleSoft Composer the permissions to access the identity URL service, manage user data via APIs, and perform requests 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.
  6. Click the pencil icon next to the default step name.
  7. Name the step Get an NTO service case and click Save.

Configure the trigger to start the flow every time a service case is created or updated in the NTO org.

  1. Click in the Choose an event that starts this flow field and select New or updated record.
  2. In the Object Type field, enter Case.
  3. Click Select Fields, select Case Number, Case Origin, Case Reason, Priority, and Status, and then click Add. You use these fields to perform integration tasks in subsequent steps of the flow.
  4. Look at the Sample Output section, which shows each selected field and its sample value from an account in the NTO org. This confirms that you're connected to the correct org and lets you know the structure of the data that is available in later steps of your flow.
    Step 1 of flow with trigger event and object type fields and Select Fields button.
  5. Click Save to save the flow.

Add an If/Else block to the flow to integrate NTO service cases with Slack notifications.

  1. Click the plus icon to add a step.
  2. Click If/Else Block. The All conditions must be met (AND) condition is selected by default.

Add a condition to the If/Else block to evaluate the status of each case.

  1. Click in the Field name and select Status, click Operator and select Equals, enter Escalated in the Value field.

Add a second step to the If branch to handle escalated cases.

  1. Click the plus icon to add a step within the If branch.
  2. Click Slack.
  3. Name the connection Slack Notification and click Create.
  4. Select NTO from the Slack workspace picklist.
  5. Click Allow to grant MuleSoft Composer the permissions to the NTO workspace. The MuleSoft Platform app is automatically added to the NTO Slack workspace, and the second step of the flow appears.

Configure the second step in the If branch to notify the support regional leader of escalated cases.

  1. Name the step Send message to regional leader and click Save.
  2. Click in the Action field and select Send a direct message to a user.
  3. For test purposes, enter your Slack username in the User field. Later, when this flow is ready for production, you’ll need to swap out this value with the Slack username of the support regional leader.
  4. Click in the Message text field and then click Custom Expression.
  5. Configure the message as follows:
    Please handle this case. Case Number: Case Number from step 1, Origin: Case Origin from step 1, Reason: Case Reason from step 1, Priority: Priority from step 1, Status: Status from step 1
  6. Leave the Bot Name and Bot Icon URL blank. By default, MuleSoft Composer uses the MuleSoft Platform Slack app to communicate with Slack.

Add an Else branch to the If/Else block of the flow.

  1. Click Add Else. You will configure the Else branch to process all cases that are non-escalated.

Add a third step to the Else branch to handle non-escalated cases.

  1. Click the plus icon to add a step to the Else branch.
  2. Click Slack and then click Slack Notification.
  3. Name the step Send message to support channel and click Save.

Configure the third step in the Else branch to handle non-escalated cases.

  1. Click in the Action field and select Post message to channel.
  2. In the Channel Name field, click the search picklist, select Pick from List, and then select customer-support.
  3. Click in the Message text field and then click Custom Expression.
  4. Configure the message as follows:
    Case Number: Case Number from step 1, Origin: Case Origin from step 1, Reason: Case Reason from step 1, Priority: Priority from step 1, Status: Status from step 1
  5. Save the flow. Your entire flow should look like this:

Entire flow with three steps.

Entire flow with three steps.

Entire flow with three steps.

Entire flow with three steps.

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 customer service case is created or updated in the NTO org, it triggers the flow. So be prepared to enter a test case in the NTO org’s Service Cloud. If the status of the case is non-escalated, a message appears in the Slack customer-support channel. So get ready to verify that the message shows up in the customer-support channel. And if the status of the case is escalated, a message appears in your direct messages. So be ready to verify that the message shows up in your direct messages. 

Follow these steps to test a flow.

  1. In the Sync NTO Service Cases with 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 the NTO org’s Service Cloud, navigate to the Cases tab, and click New.
  3. Add a new case with the following values, and then click Save.
    • Case Reason: Installation
    • Status: New
    • Priority: High
    • Case Origin: Phone
  4. Go back to your flow and wait for the test to complete. If step 1 and step 3 in the Else branch of the flow show a green check mark, this indicates the relevant steps of the flow for this non-escalated case ran successfully. Take a look at the Test Output section and see the record values you entered for the test.
    Tested flow with check marks on steps 1 and 3.Tested flow with check marks on steps 1 and 3.
  5. Open your NTO Slack workspace and verify the case notification appears in the customer-support channel.
    customer-support channel showing the test case notification.
  6. Click Test on the flow again.
  7. Go back to the NTO org’s Service Cloud, change the status of the previous test case to Escalated, and click Save.
  8. Return to your flow and wait for the test to complete. If step 1 and step 2 in the If branch of the flow show a green check mark, this indicates the relevant steps of the flow for this escalated case ran successfully. Take a look at the Test Output section and see the record values you entered for the test.
    Tested flow with check marks on steps 1 and 2.Tested flow with check marks on steps 1 and 2.
  9. Open your NTO Slack workspace and verify the case notification appears as a direct message to you.
    A direct message showing the test case notification to the test user.
  10. Repeat steps 1 through 9 to test another service case 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.

Comparta sus comentarios sobre Trailhead en la Ayuda de Salesforce.

Nos encantaría conocer su experiencia con Trailhead. Ahora puede acceder al nuevo formulario de comentarios cuando quiera desde el sitio de la Ayuda de Salesforce.

Más información Continuar para compartir comentarios