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 Microsoft Teams.
  • 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 syncs sales leads in Salesforce with lead notifications in Microsoft Teams. Then, you test your flow to ensure it syncs 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 Microsoft Teams using MuleSoft Composer.

Design a Flow

Now you’re ready to design an integration flow that syncs sales leads in Salesforce with lead notifications in Microsoft Teams. 

Follow these steps to design a flow.

Launch MuleSoft Composer from the NTO org.

  1. Log in to your NTO org using your username and password.
  2. 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 Org Leads with Microsoft Teams Notifications and click Save.

Create a trigger for the flow using the NTO org.

  1. Click Salesforce.
  2. Click Add new Salesforce connection.
  3. Name the connection NTO sandbox org.
  4. Select the checkbox This is a sandbox organization and click Create.
  5. Enter your NTO sandbox org’s username and password and click Log In.
  6. Click Allow to grant MuleSoft Composer the permissions to access your basic information, access and manage your data, and perform requests on your behalf 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.
  7. Click the pencil icon next to the default step name.
  8. Name the step Get lead and click Save.

Configure the trigger to start the flow every time a lead 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 Lead.
  3. Look at the Sample Output section, which shows each selected field and its sample value from a lead 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.
  4. Click Save to save the flow.

Create and configure an If/Else block to evaluate if the lead source is a partner referral.

  1. Click the plus icon to add a step.
  2. Click If/Else Block.
  3. Click Add Conditions. The All conditions must be met (AND) condition is selected by default.
  4. Select Lead Source as the field and Equals as the operator, enter Partner Referral as the value, and then click Save. If this condition is met, the next step in the If branch (notify partner sales) is performed.

Create the second step of the flow within the If branch to handle partner referral leads.

  1. Click the plus icon to add a step within the If branch.
  2. Click Microsoft Teams.
  3. Click Add new Microsoft Teams connection.
  4. Name the connection NTO Teams and click Create.
  5. Select your Microsoft Teams account.
  6. Click Accept to grant MuleSoft Composer the permissions to send channel messages, read the names and descriptions of teams, read the names and descriptions of channels, maintain access to data you have given it access to, and view your basic profile. MuleSoft Composer automatically tests the connection. If no error message appears, you have a successful connection, and the second step of the flow appears.
  7. Name the step Notify partner sales and click Save.

Configure the second step in the If branch to notify the partner sales channel in Microsoft Teams.

  1. Click in the Action field and select Send message to channel.
  2. Click in the Team name field and select NTO Sales.
  3. Click in the Channel name field and select Partner Sales.
  4. Click in the Message field and then click Custom Expression. You use this Custom Expression tool whenever you need to configure a message that has both dynamic field values from the preceding steps of a flow and static text that you enter.
  5. Enter New partner sales lead. Name: and select Full Name from step 1.
  6. Enter , Email: and select Email from step 1.
  7. Enter , Phone: and select Phone from step 1.
  8. Enter , Status: and select Status from step 1.
  9. Enter . and click Done.

Add an Else branch to the If/Else block of the flow to handle all lead sources that are not partner referrals.

  1. Click Add Else.

Create the third step to the flow within the Else branch to handle non-partner referral (that is, direct sales) leads.

  1. Click the plus icon to add a step to the Else branch.
  2. Click Microsoft Teams and click NTO Teams.
  3. Name the step Notify direct sales and click Save.

Configure the third step in the Else branch to notify the direct sales channel in Microsoft Teams.

  1. Click in the Action field and select Send message to channel.
  2. Click in the Team name field and select NTO Sales.
  3. Click in the Channel name field and select Direct Sales.
  4. Click in the Message field and then click Custom Expression.
  5. Enter New direct sales lead. Name: and select Full Name from step 1.
  6. Enter , Email: and select Email from step 1.
  7. Enter , Phone: and select Phone from step 1.
  8. Enter , Status: and select Status from step 1.
  9. Enter . and click Done.
  10. Save the flow. Your entire flow should look like this.

Step 1 of flow showing new or updated lead as the trigger.

If/Else block of flow showing condition to evaluate if lead source is partner referral.

Step 2 of flow within If branch showing message sent to the partner sales channel.

Step 3 of flow within Else branch showing the message sent to direct sales channel.

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 lead is created or updated in the NTO org, it triggers the flow. So be prepared to enter a test lead in the NTO org’s Sales Cloud. If the lead source is partner referral, a message appears in the partner sales channel in Microsoft Teams. So get ready to verify that the message shows up in the partner sales channel. And if the lead source isn’t partner referral, a message appears in the direct sales channel in Microsoft Teams. So be ready to verify that the message shows up in the direct sales channel. 

Follow these steps to test a flow.

  1. In the Sync NTO Org Leads with Microsoft Teams Notifications 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 Sales Cloud, navigate to the Leads tab, and click New.
  3. Add a new lead with the following values, and then click Save.
    • First name: Sakura
    • Last name: Yamamoto
    • Company: ACME
    • Phone: 03 1234 5678
    • Email: sakura.yamamoto@acme.com
    • Lead Source: Partner Referral
  4. Go back 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 partner referral lead ran successfully. Take a look at the Test Output section and see the record values you entered for the test.
  5. Tested flow showing a green check mark on step 1.

    Tested flow showing If/Else block to determine if lead source is partner referral.

    Tested flow showing a green check mark on step 2 in the If branch.

    Open your Microsoft Teams NTO Sales team and verify the lead appears in the Partner Sales channel.
    Partner Sales channel showing the test lead notification.
  6. Click Test on the flow again.
  7. Go back to the NTO org’s Sales Cloud, change the lead source of the previous test lead to Purchased List, and click Save.
  8. Return 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-partner referral lead 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 for step 1.
  9. Tested flow showing a green check mark for step 3 in Else branch.Open your Microsoft Teams NTO Sales team and verify the lead appears in the Direct Sales channel.
  10. Direct Sales channel showing the test lead notification.

    Repeat steps 1 through 9 to test another lead 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.

Salesforce 도움말에서 Trailhead 피드백을 공유하세요.

Trailhead에 관한 여러분의 의견에 귀 기울이겠습니다. 이제 Salesforce 도움말 사이트에서 언제든지 새로운 피드백 양식을 작성할 수 있습니다.

자세히 알아보기 의견 공유하기