We would like to thank Sadhana Nandakumar for their contribution to this developer tutorial.
In this tutorial, we’ll walk you through deploying a simple Mule app that uses an existing MuleSoft RPA process to update the delivery date for an order in a legacy application. You’ll learn how to:
Use MuleSoft Robotic Process Automation (RPA) to automate processes that require human input and interact with systems that do not have an API available for consumption. In this tutorial we simulate updating delivery dates in a legacy system.
Anypoint Platform
- We’ll need an Anypoint Platform account. You can sign up for a free trial account here.Anypoint Studio
- An interactive development environment for MuleSoft developers. See installing Anypoint Studio.Salesforce Developer Edition Org
- A free edition of Salesforce. Sign up for a Developer Edition Org.Salesforce Security Token
- A case-sensitive alphanumeric key that is used in combination with a password to access Salesforce via API. After you have your Salesforce Developer Edition Org you can reset and obtain your security token by following the instructions here.curl
- A command line tool for transferring data using various network protocols. See installing curl.This tutorial uses an existing RPA service deployed to Anypoint Exchange. To create your own RPA processes you will need access to RPA Manager, RPA Builder, RPA Recorder and RPA Bot installed and configured. See documentation for details.
MuleSoft provides the ability to automate tasks and deploy them as bots that can execute the assigned automation. It is possible for business and IT teams to share the automation assets by publishing them to Anypoint Exchange. We have deployed an RPA process for this tutorial that updates the delivery information to a legacy mainframe system. Let’s review it on Anypoint Exchange.
1 - Navigate to Anypoint Platform and log in.
2 - Navigate to Anypoint Exchange and click the menu option to search for assets provided by MuleSoft with the search term tutorial delivery date
. Then click on the tile labelled Tutorial: Update Delivery RPA Bot.
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.
3 - Open the startProcessNonIdempotent and use the send button to mimic starting an RPA service.
When you start a RPA service you will receive and execution Id that can be used to fetch the status of process execution.
4 - In the same API open the path /{executionId}, click the GET operation called getProcessesExecutionStatus and use the send button to mimic starting fetching the RPA process status.
Note that it returns the status code and results of the RPA service. Let’s build an API that allows us to update the delivery date using our RPA service.
1 - Open Anypoint Studio and make sure your Anypoint platform account is connected with Anypoint Studio.
2 - Create a new project by selecting New > Mule Project.
3 - Anypoint Studio will open up a New Mule Project wizard, specify the project name and click Finish.
4 - Add a HTTP listener to your Mule application and set the path to /order/{orderId}
5 - We will now add a Set Variable component to save the new delivery date from the request payload.
6 - Next, we will configure the Salesforce connector, so that we can fetch the shipment reference for the Order Id. Notice that we are passing in the Order Id information from the request and fetching the shipment information. We then add a transformer to read the results from the SOQL results.
1 - From the Mule Palette, click on Search in Exchange option.
2 - Look for the RPA Process API Tutorial: Update Delivery RPA Bot, and add it to the Selected modules.
3 - You should now see all three operations on the Mule palette.
4 - We will now add the startProcessNonIdempotent (POST) call, to our flow.
5 - Click on the green + icon to set up a connector configuration.
6 - Notice that the configuration auto-populates with the values. Test the connection and click OK to proceed.
7 - Now we will map the request data for the process execution. For this click on the mapper button on the General > Startprocessnonidempotent request data section.
8 - Map the corresponding values for orderId and deliveryDate for the process API.
9 - We will now add another HTTP listener with the path /status/{executionId}
to get the process execution status. We will add the getProcessessExecutionStatus operation to get the status of the RPA process.
1 - Right click your project canvas and select Run. Wait for our Mule application to deploy.
2 - Send a curl request to the HTTP endpoint we created
1
curl -d "10/29/2022" -X POST http://localhost:8081/order/00000192
We will receive the RPA service execution id.
Output
1
2
3
{
"executionId" : "9a5b7d9a-6563-43c2-89d8-6bc2cec7de47"
}
3 - Next let’s call the endpoint to retrieve the current status of the RPA service.
1
curl -X GET http://localhost:8081/status/9a5b7d9a-6563-43c2-89d8-6bc2cec7de47
Output
1
2
3
4
5
6
7
8
9
10
{
"executionId" : "9a5b7d9a-6563-43c2-89d8-6bc2cec7de47",
"label" : "",
"result" : {
"deliveryDate" : "10/27/2022",
"shipmentId" : "332434"
},
"status" : "success",
"statusChangedAt" : "2022-11-09T14:11:35.525441Z"
}
4 - If you have created your own RPA service to use for this tutorial, and have access to RPA Manager you will also be able to see the completed process under Process Automation > Process Management.
Congratulations! You now have a basic Mule application that provides an API to update the delivery date in a legacy system by using an RPA service. We also provided an API to check on the execution status to verify it was successful.
In this tutorial, you learned how to:
To learn more about MuleSoft RPA, check out:
Start your 30-day free trial of the #1 platform for integration, APIs, and automation. No credit card required. No software to install.
Questions? Ask an expert.