Reading Time: 14 minutes

MuleSoft RPA provides the ability to automate repetitive tasks with bots that can intelligently process documents, enter data, or act on a user’s behalf – all without any code. Fully integrated with Salesforce Clouds, MuleSoft RPA enables Salesforce admins, business teams, and developers to leverage robotic process automation technology to make end-to-end automation possible. We’ll discuss how we can integrate MuleSoft RPA with Salesforce flow to achieve this.

Creating and publishing an RPA process as a reusable asset

MuleSoft RPA allows organizations to manage RPA automation in a unified platform offering a fully integrated lifecycle management where each project will go through a series of orchestrated phases like evaluation, design, build, test, and production. 

Business teams can use the RPA manager to design the business process they want to automate and map their automation process using the standard BPMN notation. Business teams can also use RPA Process Recorder to capture the actions to automate on the user’s windows desktop. 

Once done, the developers can use the RPA Builder to implement the RPA process (build phase) and finally synchronize it back to RPA Manager for test and production deployment. Let us assume for this exercise, that we have an RPA process, that reads an email and extracts data from a PDF document, ready for deployment to production. 

OCRWorkflow automation

RPA Manager can be connected to the Anypoint platform, with a specific named account to enable publishing automation assets to Exchange. Let’s look at how we can publish an RPA automation asset to Exchange.

Create and configure a Connected App in Anypoint Access Management

The Connected Apps feature in Anypoint, provides a framework that enables an external application to integrate with the Anypoint Platform using APIs that take advantage of the  OAuth 2.0 and OpenID Connect standards. On the Anypoint Platform’s Access Management page, we will create a connected application with the type as client credentials. We will add the RPA Integrator scope to this configuration. On creation, notice that the connected app shows the Client ID and Client Secret.

Access management, update app

Configure Anypoint Platform Credentials in RPA Manager

In the RPA Manager, select Settings from the Organization Management left-hand side menu. We will add the Client ID, Client Secret that we obtained from the connected app in the step before, and the correct domain to connect the RPA Manager to the desired Anypoint Platform. It’s possible to pair MuleSoft RPA with any existing Anypoint Organization.

OCR bot settings

Deploy the RPA process to Production and publish to Exchange

Now, the RPA process can be deployed to production. For the RPA process to be available on Exchange, we will create an invokable run configuration. The invokable run configuration assigns the RPA process to a bot so that it can be invoked via an API. This provides the ability to invoke it from any application with REST Web Services capabilities leveraging the OAS3 API Specification standard. 

OCRWorkflow

Once done, the API for the RPA process is now available on Anypoint Exchange. The published asset has the same name as that of the RPA Process.

OCR workflow summary

Notice that PUT, POST, and GET operations are generated on this API. PUT/POST operations can start an RPA process by specifying the required input parameters. Notice that when a startProcessNonIdempotent is executed, it generates an execution Id.

This approach improves collaboration across teams, by providing a way to discover, share and reuse automation assets.

latest report
Learn why we are the Leaders in API management and iPaaS

Configure External Services for MuleSoft

Next we will need to connect Salesforce to MuleSoft Anypoint Platform to configure the connected app and named credential for Anypoint platform. Once done, we should now have a named credential setup on Salesforce to connect with a specific Anypoint Organization.

named credentials

Configure an external credential for authenticating to MuleSoft RPA Manager

While the first step allowed us to discover and reuse the RPA automation within the Salesforce platform in tools like Flow Builder, it is also necessary to set up the credentials to properly invoke this RPA automation successfully. The fact you can discover and reuse does not mean you are entitled to invoke the endpoint and in the API world, you need to be entitled to the permissions to use this API at runtime. This section will cover how to set this part up.

Creating a User API Key on RPA Manager

User API keys are required to integrate RPA processes with third-party applications. A User API key can be created from the User Management page in RPA Manager. A User API Key is what will allow a user or client application to use this RPA process successfully. Without it, all invocation attempts will fail. It is worth pointing out that an admin can revoke this User API Key at any time if needed.

User API keys

Creating a Permission Set 

A permission set in Salesforce is a collection of settings and permissions that give users access to various tools and functions. We will need to create and assign a permission set in Salesforce that enables users to invoke this MuleSoft RPA process in a Salesforce flow.

Permission Sets

Creating an External Credential for RPA Manager

We will now link the external credential to a user’s permission set and to the named credential that specifies the URL for MuleSoft RPA Manager. The external credential details how Salesforce authenticates to MuleSoft RPA Manager. 

We will first create an external credential that maps the permission set we created,  with an authentication parameter whose value is the API key that we obtained from the MuleSoft RPA Manager. Additionally, we will create a custom header so that we can pass in the x-apikey as a part of the API call.

Related named credentials

Creating a Named Credential for MuleSoft RPA Manager

A named credential specifies the URL of a callout endpoint and its required authentication parameters in one definition. We will now create a Named Credential that maps the URL of the RPA Manager instance with the external credentials that we created in the previous step.

rpaulr

Invoke RPA Process from Salesforce Flow

We will now configure an external service for the RPA Process API and invoke it from Salesforce Flow. 

Create an external service 

External Service in Salesforce is a way by which we can integrate with APIs declaratively without using code. We will create an external service using the named credentials we created for Anypoint platform. We should be able to see all the RPA Process API versions. Notice that on the service configuration, we are using the Named Credentials we created for RPA Manager.

Add an External Service

All of the operations that the RPA Process API provides are now shown for the external service.

Add an external service

Creating a Salesforce Flow and invoking the external service

We can now invoke the RPA Process external service from Salesforce flow. We will first create a screen flow and define an Apex-defined variable to map the input variable for the process run.

New Resource

We will now add an assignment step to map the input variable.

New Assignment

Finally, we will define an action step to invoke the RPA Process API using the external service.

New Action

The Flow is now ready to be tested.

Toolbox

We can now debug the Salesforce Flow to trace how the RPA Process API is invoked from the flow.

All done

Notice that the request was successfully executed. It is also possible to check the status of the process execution by using the executionId by adding an action step for the GET operation.

Conclusion 

Salesforce Flow and MuleSoft RPA can help companies replace tedious, manual tasks with automated processes to accelerate productivity and provide better customer experiences, at scale. Using simple configuration using clicks not code, it is possible to easily discover and reuse automation assets across the organization to make end-to-end automation possible. 

All RPA automation created with MuleSoft RPA are reusable building blocks that can encapsulate the tedious details to integrate with legacy and new applications enabling more automation capability in the hands of low-code tools like those in Salesforce flow.