+
+

Module 3: Invoke MuleSoft RPA from Salesforce Flow

Overview

Salesforce flow is a powerful automation tool that automates complex business processes by collecting data and doing something in Salesforce or external system. Flow Builder is the declarative interface used to build individual flows. Flow Builder can be used to build code-like logic without using a programming language.

In this Module you will build a flow that invokes the RPA Bot that we build in Module 1 when a new record(Contact) is created in Salesforce.

For more information, refer to the Salesforce Flow Builder documentation for configuration and usage details

Salesforce Flow Builder: Getting Ready

  1. In a Google Chrome Window, log into the Salesforce with the URL and credentials below. This is the environment where you will create the flow that invokes a bot upon creation of a new contact and will get an email notification.

    URL: https://automationworkshop-23.my.salesforce.com
    Username: automationworkshop@nto.com
    Password: <to be provided by the instructor>
  1. Click on the gear icon located at top right of the landing page and select 'Setup' option

3 1
  1. Click on Quick Find on left side of the page and type in 'Flows'.

3 2
  1. Select the Flows under Process Automation

3 3

Creating a New Flow

  1. Select Record-Triggered Flow

3 4
  1. Click Create

  2. Type 'Contact' in the Object text box and Select 'Contact'.

  3. Select the trigger as 'A record is created'

  4. Select the Condition requirements as 'All Conditions are Met (AND)'

  5. Configure the Email field to satisfy the Condition as not null

3 5
  1. Select 'Actions and Related Records' option to Optimize the flow for.

  2. Click the checkbox to include a 'Run Asynchronous Path'

  3. Click Done

Variable Assignment

  1. Click Toolbox icon

  2. Click New Resource

  3. Expand Resource type drop down

3 6
  1. Select 'Variable' as Resource type

  2. Ensure your Resource type is Variable

  3. To more easily follow the later steps use inputVar as the API Name

  4. Set the Data Type as Apex-Defined

  5. For Apex Class enter the text below

    ExternalService__MuleSoftNewsLetterSignUpApr5_ProcessExecutionWithExecutionId
  6. Click Done

3 7
  1. Click the plus sign to add an Element.Make sure you add the element under 'Run Asynchronously' path

  2. Click on Assignment

3 8
  1. Label your Assignment as "AssignVar"

    1. API Name will Automagically populate

  2. Set Variable Values

      Use Equals for the Operators
    .. {!inputVar.inputArguments.userEmail}
    .. {!$Record.Email}
    1. {!inputVar.executionId}

    2. {!$Flow.InterviewGuid}

  3. Click Done

3 9

Add RPA Bot to an Action

  1. Click on plus sign after the 'Assign' Element

  2. Select 'Action' under Interactions

3 10
  1. Type and select 'startProcess' in Action text box

  2. Label the action as 'InvokeSignUpBot'

  3. Toggle on the include to set the body.

  4. Type '{!inputVar}' in the body.

NOTE - When you start typing,the variable might auto-populate with a '.' at the end like this {!inputVar}.', make sure the '.' is removed before proceeding.

3 11

Save the Flow

  1. Click Save

  2. Label the Flow with your first and last name. eg:- If my name is Jane Doe, Label the flow as 'MuleSoft_NewsLetter_SignUp_Jane_Doe'

  3. Click Save

3 12

Debuggig and Validating the Flow

Before we Debug the flow, let’s first create a Contact(which is the Object the flow is configured to trigger on)

  1. Open another tab of the Salesforce Org and click on the square made up of 9 dots.

  2. Search for contacts

  3. Click Contacts

3 13
  1. Click 'New' Button to create a new Contact

  2. Select the 'Contact' record type

  3. Click Next

3 14
  1. Enter your first name and last name

  2. Type or Select 'Northern Trail Outfitters' as Account Name

  3. Enter your email

  4. Click Save

3 15

Once Contact is created, we can navigate back to our flow that we saved and let’s debug our flow against the contact we just created.

  1. Click Debug button

  2. Make sure to select the path to Debug as 'Run Asynchronously'.This is because our path for Run immediately is empty.

  3. Under Debug options, only select 'Run flow in roll back mode'

  4. Type your first name in Contact text box.

  5. Select the Contact(the one we created in above step with your first and last name)

  6. Click Run

3 16

Upon successful execution of the flow, we should see the success path highlighted in Orange.We can validate the data movement by expanding each of the steps the flow touched.For example: we can expand the action element 'MuleSoftNewsLetterSignUpApr5.startProcess' in the right panel and can validate the inputs(should be your email you provided when created the contact) and the response code 201 illustrates that the flow execution was successful.

You can add additional logic like adding a decision element to check for successful or unsuccessful invocation of RPA and send an email for notification.

3 17
Submit your feedback!
Share your thoughts to help us build the best workshop experience for you!
Take our latest survey!