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.
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:
|
In the If branch of the If/Else block, use:
|
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.
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.
- Log in to your NTO org using your username and password.
- From the App Launcher, enter
Composer
and select MuleSoft Composer.
Create a new flow.
- Click Create New Flow.
- Click the pencil icon next to the default flow name.
- 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.
- Click System Event, and then click Salesforce.
- 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. - Name the connection
NTO sandbox org
. - 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. - Enter your NTO sandbox org’s username and password and click Log In to Sandbox.
- 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.
- Click in the Choose an event that starts this flow field and select New or updated record.
- In the Object Type field, enter
Case
. - In the Conditions to filter the objects picklist, select All conditions must be met (AND).
- 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. - Click Save to save the flow.
Create and configure an If/Else block to check if a corresponding issue exists in Jira.
- Click the plus icon to add a step.
- 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.
- 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.
- Click the plus icon to add a step within the If branch.
- Click System Action, and then click Jira.
- Click Add new Jira connection.
Note: If this is your first Jira connection, this option doesn’t appear. Go to the next step. - Name the connection
NTO Jira
and click Create. - 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.
- Click in the Action field and select Create issue with custom fields.
- 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
- Click Select Optional Fields, select Salesforce Case ID and Salesforce Case Reason, and then click Apply.
- 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
- 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.
- Click in the Source Field and select Status from step 1 of the flow.
- Click Next, and then click Create new picklist.
- Enter
Salesforce to Jira Status
as the global picklist name. - In the When this value is returned column of the mapping table, enter
New
. - In the map this value column of the mapping table, select To Do from the picklist.
- Click Add Rows.
- 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
- Click Create Picklist, and then click Apply.
- 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.
- Click the plus icon to add a step to the If branch.
- 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.
- Click in the Action field and select Update record.
- In the Object Type field, enter
Case
. The Case ID is automatically selected because it’s a required field. - Click Select Optional Fields, select Jira Issue ID, and then click Apply.
- 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.
- Click Add Else.
Create the fourth step for the flow within the Else branch using the existing NTO Jira connection.
- Click the plus icon to add a step to the Else branch.
- Click System Action, click Jira, and then click NTO Jira.
Configure the fourth step to update the issue that corresponds to the triggering case.
- 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.
- 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
- Click Select Optional Fields, select Salesforce Case Reason, and then click Apply.
- 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
- 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.
- Click in the Source Field and select Status from step 1 of the flow.
- Click Next, and then select Salesforce to Jira Status. Notice that the mapping table displays the values configured in step 2 of the flow.
- Click Apply.
- Repeat steps 1 through 4 to select the Salesforce to Jira Priority picklist mapping for the Priority field.
- Save the flow. Your entire flow should look like this.
Good job! In the next unit, you learn how to test your flow to ensure it works as expected.