Skip to main content

Design a Flow

Learning Objectives

After completing this unit, you’ll be able to:

  • Prepare to design a flow.
  • Design a flow to automatically sync new or updated customer service cases in Salesforce with issues in Jira.

Prepare to Design a Flow

Recall from MuleSoft Composer Basics that a flow is a sequence of steps that you assemble and configure to integrate systems and data. Before designing a flow, you should sketch out the steps of the flow using a flowchart. You can do this using paper and pencil to get a good idea of what your flow will look like.

Here’s an example flowchart showing all the steps of an integration flow for the NTO use case described in the previous unit.

Flowchart for the integration flow for NTO use case.

Here’s a detailed description of the tasks and their associated flow components to create a flow for this NTO use case.

Task Flow Components

Find any new or updated case in Service Cloud.

Trigger from Service Cloud on new or updated case that requires engineering involvement.

Determine if a corresponding issue exists in Jira.

If/Else block to check if the Jira issue ID is empty, indicating no matching issue exists in Jira.

If a corresponding issue doesn’t exist:

  • Create an issue in Jira.
  • Update the case in Service Cloud.

In the If branch of the If/Else block, use:

  • Action step to create an issue with relevant case details in Jira.
  • Action step to update the case with the Jira issue ID in Service Cloud.

If a corresponding issue exists, update the issue in Jira.

In the Else branch of the If/Else block, use an action step to update the issue with relevant case details in Jira.

In addition, since the Status and Priority fields of the Salesforce Case object and their corresponding fields of the Jira Issue object contain different values, you need to use MuleSoft Composer’s picklist mapping tool to map the values. At runtime, appropriate field values from Salesforce are dynamically assigned to Jira.

First, map the Status values from the Salesforce Case object to the Jira Issue object as follows.

Salesforce Case Status Jira Issue Status

New

To Do

Working

In Progress

Escalated

In Progress

Closed

Done

In case of a different value

In Progress

Next, map the Priority values from the Salesforce Case object to the Jira Issue object as follows.

Salesforce Case Priority Jira Issue Priority

Low

Low

Medium

Medium

High

High

In case of a different value

Medium

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 Jira using MuleSoft Composer.

Design a Flow

Now you’re ready to design an integration flow that syncs new or updated customer service cases in Salesforce with issues in Jira. 

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 Cases with Jira Issues and click Save.

Create a trigger for the flow using an NTO org sandbox connection.

  1. Click System Event, and then click Salesforce.
  2. Click Add new Salesforce connection to create a connection to the NTO sandbox org.
    Note: If this is your first Salesforce connection, this option doesn’t appear. Go to the next step.
  3. Name the connection NTO sandbox org.
  4. Select the checkbox This is a sandbox organization and click Create.
    Note: If you use a developer org, skip selecting this checkbox and click Create.
  5. Enter your NTO sandbox org’s username and password and click Log In to Sandbox.
  6. 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.

Configure the trigger to start the flow every time a customer 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. In the Conditions to filter the objects picklist, select All conditions must be met (AND).
  4. Select Requires Engineering Assistance as the field, Equals as the operator, and enter true as the value.
    Tip: When selecting a value for a field, enter a few initial letters of its name, and then select the relevant field that appears. 
  5. Click Save to save the flow.

Create and configure an If/Else block to check if a corresponding issue exists in Jira.

  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 in the If branch of the If/Else block.
  3. Select Jira Issue ID as the field and Is empty as the operator. If this condition is met, it means a corresponding issue doesn’t exist in Jira. So, the next two steps (create Jira issue and update NTO org case) in the If branch are executed.

Create the second step for the flow within the If branch of the If/Else block using an NTO Jira connection.

  1. Click the plus icon to add a step within the If branch.
  2. Click System Action, and then click Jira.
  3. Click Add new Jira connection.
    Note: If this is your first Jira connection, this option doesn’t appear. Go to the next step.
  4. Name the connection NTO Jira and click Create.
  5. Click Accept to grant MuleSoft Composer the permissions to view user, project, and issue information; create, edit, and delete issues, post comments, and create worklogs; create and edit project settings and project-level objects; and take administration actions using your Jira account. The NTO Jira connection is created, and the second step of the flow appears.

Configure the second step to create issues using relevant case details in Jira.

  1. Click in the Action field and select Create issue with custom fields.
  2. Map the following fields of the second step of the flow as follows.
    • Project: CS
    • Type: Bug
    • Summary: Subject from step 1 of the flow
    • Description: Description from step 1 of the flow
    • Reporter: click the search picklist, select Pick from List, and then select your Jira username
    • Assignee: click the search picklist, select Pick from List, and then select another Jira username of your choice
  3. Click Select Optional Fields, select Salesforce Case ID and Salesforce Case Reason, and then click Apply.
  4. Map the fields to their corresponding values from step 1 of the flow as follows.
    • Salesforce Case ID: Case ID
    • Salesforce Case Reason: Case Reason

Create picklist mappings between Salesforce and Jira for the Status and Priority fields in the second step of the flow

  1. Click in the Status field and select Picklist Mapping. The Picklist Mapping dialog box appears, showing status from step 2 of the flow as the target field.
  2. Click in the Source Field and select Status from step 1 of the flow.
  3. Click Next, and then click Create new picklist.
  4. Enter Salesforce to Jira Status as the global picklist name.
  5. In the When this value is returned column of the mapping table, enter New.
  6. In the map this value column of the mapping table, select To Do from the picklist.
  7. Click Add Rows.
  8. Repeat steps 5 through 7 to populate the mapping table with the following values.
    When this value is returned… …map this value

    Working

    In Progress

    Escalated

    In Progress

    Closed

    Done

    In case of a different value

    In Progress

  9. Click Create Picklist, and then click Apply.
  10. Repeat steps 1 through 9 to create a picklist mapping for the Priority field called Salesforce to Jira Priority with the following values.
    When this value is returned… …map this value

    Low

    Low

    Medium

    Medium

    High

    High

    In case of a different value

    Medium

Create the third step for the flow within the If branch using the existing NTO sandbox org connection.

  1. Click the plus icon to add a step to the If branch.
  2. Click System Action, click Salesforce, and then click NTO sandbox org.

Configure the third step to update the NTO org case with the associated Jira issue ID.

  1. Click in the Action field and select Update record.
  2. In the Object Type field, enter Case. The Case ID is automatically selected because it’s a required field.
  3. Click Select Optional Fields, select Jira Issue ID, and then click Apply.
  4. In the Record section, map the fields to the preceding steps of the flow as follows.
    • Case ID = Case ID from step 1
    • Jira Issue ID = Id from step 2

Add an Else branch to the If/Else block to handle the issue that corresponds to the triggering case.

  1. Click Add Else.

Create the fourth step for the flow within the Else branch using the existing NTO Jira connection.

  1. Click the plus icon to add a step to the Else branch.
  2. Click System Action, click Jira, and then click NTO Jira.

Configure the fourth step to update the issue that corresponds to the triggering case.

  1. Click in the Action field and select Update issue with custom fields. The Issue ID or Key is automatically selected because it’s a required field.
  2. Map the following fields of the fourth step as follows.
    • Project: CS
    • Type: Bug
    • Issue ID or Key: Jira Issue ID from step 1 of the flow
    • Summary: Subject from step 1 of the flow
    • Description: Description from step 1 of the flow
    • Assignee: click the search picklist, select Pick from List, and then select a Jira username of your choice
  3. Click Select Optional Fields, select Salesforce Case Reason, and then click Apply.
  4. In the Salesforce Case Reason field, select Case Reason from step 1 of the flow.

Select picklist mappings for the Status and Priority fields in the fourth step of the flow

  1. Click in the Status field and select Picklist Mapping. The Picklist Mapping dialog box appears, showing status from step 4 of the flow as the target field.
  2. Click in the Source Field and select Status from step 1 of the flow.
  3. Click Next, and then select Salesforce to Jira Status. Notice that the mapping table displays the values configured in step 2 of the flow.
  4. Click Apply.
  5. Repeat steps 1 through 4 to select the Salesforce to Jira Priority picklist mapping for the Priority field.
  6. Save the flow. Your entire flow should look like this.
    Step 1 of flow showing new or updated NTO org case with condition to determine if case requires engineering assistance as the trigger.If/Else block with If branch showing condition to determine if Jira issue ID is empty.Step 2 of flow in If branch to create an issue with fields including project, status, and priority in Jira.Rest of step 2 of flow in If branch to create an issue with case ID and case reason in Jira.Step 3 of flow in If branch to update case with Jira issue ID.Else branch of If/Else block and step 4 of flow within Else branch to update corresponding issue with fields including status, priority, and summary in Jira.Rest of step 4 of flow in Else branch to update corresponding issue with description, assignee, and case reason in Jira.

Good job! In the next unit, you learn how to test your flow to ensure it works as expected.

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