## Overview – Using MuleSoft Composer for Salesforce and External Systems

Integrating data with MuleSoft Composer for Salesforce and MuleSoft RPA easy. This article and corresponding video will show the straightforward process that enables updating Salesforce with external data from a MuleSoft RPA process.

As prerequisites, the following are required:

- Salesforce, MuleSoft Composer, and MuleSoft RPA licenses
- Anypoint Platform Credentials
- MuleSoft Composer Credentials
- Salesforce Org Credentials
- Client ID and Client Secret for Connected App with “RPA Invocable Process” scope
- Mulesoft RPA Tenant Name
- Invokable MuleSoft RPA process in Production Phase

To see how to generate the invokable MuleSoft RPA process, the MuleSoft RPA tenant name, and the Connected App details, see our prior posts: [Invoke MuleSoft RPA Process via HTTP and Postman Part 1](/content/invoke-an-rpa-process-in-mulesoft-using-http-part-1/index.html) and [Invoke MuleSoft RPA Process via HTTP and Postman Part 2](/content/invoke-a-mulesoft-rpa-process-via-http-and-postman-part-2/index.html).

The use case walked through here will show how to trigger a flow upon creation of a new Salesforce record, call a MuleSoft RPA process, and then update that Salesforce record with output data from the MuleSoft RPA process execution.

# Step-by-Step Process in Composer

To start, log in to [MuleSoft Composer](https://composer.mulesoft.com/), and from the main flow, go to Create new flow -> From scratch :

The process asks what should start the flow; choose a System Event of type Salesforce. This configures the flow to be triggered by Salesforce activity:

Add a new Salesforce connection; give a useful Connection Display Name and click Connect. This will pop up a Salesforce login window which requires entering valid Salesforce credentials:

Upon entering of valid credentials, an “Allow Access?” screen is shown. Allow access. At this point you have a successful Salesforce connection and are ready to configure the details of the trigger.

Fill in the form to provide the trigger data. The example here triggers upon any new Product record being created. It polls every 15 seconds for newly-created Products:

After configuring this, the Trigger configuration is complete. Hit the plus button to create a new action step.

For this use case, the next step should also be a System Action. This System Action is of type MuleSoft RPA:

Add a new Mulesoft RPA connection. Provide a meaningful Connection Display Name, and use Authorization Type = OAuth 2.0 Client Credentials. Then use the prerequisites mentioned above to fill in the RPA API URL, the Client ID (using the Connected App client ID), the Client Secret (the Connected App client secret), and the Token URL (this should be a standard value: [https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token](https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token)). After configuring this, click Connect:

Once the connection is successfully established to MuleSoft RPA, select the relevant RPA process to be called as part of this Composer flow. And for Output, select “Use response in this flow”. The use case illustrated here also adds an input field to the RPA process; it sets the “BuildCategory” activity parameter for the RPA execution equal to the name of the Product that was created to trigger the flow:

The flow is now configured to call the MuleSoft RPA process. The use case requires one more step; this step is another Action Step to update Salesforce with the RPA process’s output data.

Hit the plus button to add one more Action Step, and once again select System Action. Select Salesforce as the action type. Use the Salesforce connection that was created earlier in the process. This time, the action is “Update record”. Object Type is the same object type that was used to trigger the flow (Product). An ID (Product ID) is required to tell Composer which object to update. Set the value for Product ID = Product ID from the “On New record” trigger in the input box:

Add one more field from “Select Additional Fields” to add Product Description; this is the field that will get updated with the RPA output data in this use case. This particular use case uses a Custom Expression to enable multiple RPA output fields to be utilized in the Salesforce object update. Configure the expression as shown in the screenshot and hit Apply:

After applying the custom expression, the Update action is successfully configured:

Click Save and name the Composer flow appropriately. Once saved, click the Test button to test out the Composer flow. This will have Composer start polling for newly-created Product records in the configured Salesforce org:

## Test it from Salesforce

With the Composer flow running its Test, open up Salesforce. Go to the Products tab. Click New:

Create a new Product with a useful Product Name (“Table” in this use case). As mentioned in the Composer setup section, the Product Name is mapped to the RPA BuildCategory input activity parameter. Leave the Product Description blank, as the Composer flow will be updating that field with RPA output. Click Save to create the Product:

After clicking Save, go back to Composer where the Test is running. Within 15 seconds (the polling time), the Composer Test should move to a status of “Processing…”:

It may take a minute or two for the RPA process to execute. Once it does, some output will show in each Action Step. The screenshot below shows the output data from the RPA process:

Next, verify that the Salesforce update completed correctly by going to the newly-created product in Salesforce and checking its Product Description. In this case, it shows that the Product is updated successfully:

## Conclusion – Using MuleSoft Composer for Salesforce and External Systems

This example is just one of thousands of use cases you could dream up.  The goal is to get you thinking about integrating your different systems, reducing duplication of effort, and feeling confident that with MuleSoft and RPA, anything can be connected to your Salesforce org (or any other systems you might have in play).

While MuleSoft Composer for Salesforce is our preferred way, your situation might be more complex and you could require MuleSoft Anypoint.  In either case, your data is within reach of multiple systems, safely, efficiently, and well-architected.

Check out the video presentation of this article:

Update External Data with Salesforce using MuleSoft Composer and RPA - YouTube

Tap to unmute

[Update External Data with Salesforce using MuleSoft Composer and RPA](https://www.youtube.com/watch?v=c700mlH1d1w) [CloudFirst Labs](https://www.youtube.com/channel/UC1sSMU1c7Ru-NmFS-aAdPLQ)

CloudFirst Labs202 subscribers

## Talk to the Professionals!

To learn more about our [MuleSoft IDP](/content/mulesoft/index.html), MuleSoft RPA, Partner Manager and EDI, or [Salesforce](/content/salesforce/index.html) services, please visit our website or fill out a Contact Us form [here](/content/contact/index.html).

## Overview – Using an Alternate to the MuleSoft Sharepoint Connector

In several of my previous blog posts ( [RPA Introduction](/content/automate-processes-using-mulesoft-rpa-intro/index.html), [Iterate over HTML](/content/mulesoft-rpa/index.html), [Web Form Filling](/content/effortless-web-form-filling-using-mulesoft-rpa-part-1/index.html), and others), we learned that the MuleSoft RPA processes can be used to handle a plethora of use cases and these processes can be triggered from all sorts of common applications. This post shows how easily a [MuleSoft RPA](https://www.mulesoft.com/platform/rpa) process can be used to work with Sharepoint data. The use case kicks off a published RPA process, triggered by the creation or upload of a new file in a specific Sharepoint folder. The RPA process receives the name of the file, downloads the file, parses the data, and uses the parsed data to do swivel-chair operations updating another application (Salesforce). Whereas Part 1 focused on the Sharepoint side of this integration, this Part 2 post focuses on the MuleSoft RPA Builder side.  Follow along as we show you this alternate method of getting things done without using the MuleSoft Sharepoint Connector

This use case implementation has 4 workflows:

- Download a CSV from Sharepoint
- Log in to Salesforce
- Create a Quote from CSV
- Add Products to the Quote

The key aspects this post will focus on are:

- Downloading the file from Sharepoint without logging in to Sharepoint at each RPA process run
- Find the downloaded file
- Parse useful data from the downloaded file

## Important Callout

It is important to note that this setup is not the only way to integrate with Sharepoint; this is to specifically show how to directly integrate Sharepoint with a MuleSoft RPA process. However, for organizations with Anypoint Platform subscriptions, a MuleSoft application can be used to easily monitor and/or integrate with Sharepoint using the robust [MuleSoft Sharepoint Connector](https://www.mulesoft.com/exchange/com.mulesoft.connectors/mule-sharepoint-connector/). The connector has dozens of operations available to handle Sharepoint integration needs, and MuleSoft’s integration platform enables all sorts of processing and orchestration options.

## Key Aspects of MuleSoft RPA Sharepoint Integration

### How to Download Sharepoint File without Login

This use case shows how to configure the RPA process to download the file from Sharepoint without logging into Sharepoint at each run. To do this, manually log into the PC/VM as the Windows user that the RPA bot runs as. With that user, open Chrome and log into Sharepoint. Ensure that the login persists; close Chrome and reopen and make sure it is still logged in to Sharepoint. If it is, that login info is stored in that user’s Chrome user data. With that in place, open the Chrome Web Session configuration and add an “Additional argument”. Set –user-data-dir=C:\\Users\\%USERNAME%\\AppData\\Local\\Google\\Chrome\\User Data. This will have the RPA process use the bot user’s Chrome user data which will include the Sharepoint login. This will save the RPA developer from needing to configure the RPA process to log in to Sharepoint each time the process runs:

### How to Find Downloaded File

After the process navigates to the URL (<sharepointBaseURL>/<sharepointFileName>), Chrome automatically downloads the file to C:\\Users\\%USERNAME%\\Downloads. The file can then be found in that downloads directory with the file name represented by sharepointFileName:

### How to Parse the Data from Downloaded File

To parse the data from the file, get the number of lines in the file. Loop over those lines one by one, and convert each CSV line into an array of values (e.g. productName and listPrice in the example screenshot). These values can be used in later steps to do data entry into the target system:

## Putting the Alternate Method to Using the MuleSoft Sharepoint Connector All Together

To see this in action, and learn more details about this alternate method to the MuleSoft Sharepoint Connector, check out the video that goes along with this post:

Integrate Sharepoint with MuleSoft RPA Part 2 - YouTube

Tap to unmute

[Integrate Sharepoint with MuleSoft RPA Part 2](https://www.youtube.com/watch?v=JenpwmRBqes) [CloudFirst Labs](https://www.youtube.com/channel/UC1sSMU1c7Ru-NmFS-aAdPLQ)

CloudFirst Labs202 subscribers

After reading the blogs and watching the videos, it will be clear how straightforward it is to automate Sharepoint interactions with other organizational applications using MuleSoft RPA.

## Talk to the Professionals!

To learn more about our [MuleSoft RPA](/content/mulesoft/index.html), MuleSoft and EDI, or [Salesforce](/content/salesforce/index.html) services, please visit our website or fill out a Contact Us form [here](/content/contact/index.html).

## Overview – Web Form Filling Using MuleSoft RPA (Part 2)

We’re all here reading this post because we know that [MuleSoft RPA](https://www.mulesoft.com/platform/rpa) is a great tool for the automation of basic Web tasks, such as filling out forms. This example shows how Salesforce can provide data to a MuleSoft RPA process to fill in a Web form, and Salesforce gets updated with output data from the RPA process. Salesforce and MuleSoft RPA work together effortlessly for a smoothly integrated automation experience.

## Prerequisites for Web Form Filling Using MuleSoft RPA

The following pre-requisites are needed for this example:

- Licenses for Salesforce and MuleSoft RPA
- Anypoint Platform credentials
- Salesforce credentials
- A MuleSoft RPA process in Production phase with an invokable run configuration\*
  - URL of this invokable RPA
  - Client ID and Client Secret for Connected App with “RPA Invocable Process” scope

\*For assistance with any part of this pre-requisite, please see [Part 1](/content/effortless-web-form-filling-using-mulesoft-rpa-part-1/index.html) of this blog post and/or Cloud First Labs’ prior blog posts on invoking a MuleSoft RPA process via Postman:

[Invoke a MuleSoft RPA Process via HTTP and Postman – Part 1](/content/invoke-an-rpa-process-in-mulesoft-using-http-part-1/index.html)

[Invoke a MuleSoft RPA Process via HTTP and Postman – Part 2](/content/invoke-a-mulesoft-rpa-process-via-http-and-postman-part-2/index.html)

## Salesforce – Set up MuleSoft Services

MuleSoft Services must be set up for Salesforce to properly connect to the MuleSoft RPA process. To handle this, log in to Salesforce and go to Setup -> MuleSoft -> Services:

Log in, using Anypoint Platform credentials, to MuleSoft Anypoint Platform and grant access. Under the covers, this creates an external credential, a named credential, and an auth provider in Salesforce, all named “MuleSoft Anypoint Platform US”. This also automatically creates a “MuleSoft Anypoint Platform” permission set. This example will require setting up a separate external credential, named credential, and permission set, as shown in the steps below.

## Salesforce – Create External Credential

Go to Setup -> Security -> Named Credentials. From there, go to the External Credentials tab. Click New:

In the New External Credential window, provide a Label and Name for this External Credential (e.g. “RPAWebFormExternalCredential”) and select OAuth 2.0 as the Authentication Protocol. Authentication Flow Type gets set to Client Credentials with Client Secret Flow, and Identity Provider URL gets set to the OAuth2 token URL used by the RPA process (e.g. [https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token](https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token)). Click Save:

Next, a Principal needs to be created within this External Credential. From the main screen for the External Credential, scroll down to the Principals section and click New.

Fill in a name for the Principal and then enter the Client ID and Client Secret for the related Connected App (mentioned in the Prerequisites section above). This provides the External Credential with the actual credentials it needs to invoke the RPA process. Click Save:

## Salesforce – Create Named Credential

With the External Credential in place, it now must be associated with a Named Credential. Go to Setup -> Security -> Named Credentials. Go to the Named Credentials tab and click New.

On this screen, enter a label and name, and then for the URL field, use the base URL for the relevant organization’s RPA processes. (For example, the Cloud First Labs’ RPA URL is [https://cloud-first-labs.rpa.mulesoft.com](https://cloud-first-labs.rpa.mulesoft.com/)). Ensure that the Enabled for Callouts is checked. For External Credential, select the External Credential created in the “Salesforce – Create External Credential” section above.  Ensure that Allow Formulas in HTTP Body is checked and click Save:

## Salesforce – Create Permission Set

Next, create a Permission Set by going to Setup -> Services -> Permission Sets -> New. For this exercise, name the Permission Set “RPA API Access”. Click Save:

Within that permission set’s page, go to the Apps section and click External Credential Principal Access:

Within this, go to Edit. Then add the RPA External Credential Principals:

Then click Manage Assignments and assign that permission set to someone with lots of access (such as a System Administrator). In my case, I assigned the permission set to my user (“Joe Kalb”) who is a System Administrator.

## Salesforce – Create External Service for RPA Invocation

Next, an External Service must be created to invoke the RPA process. Go to Setup -> MuleSoft -> Services. Make sure the system is still logged in to Anypoint Platform. Then click Import. In the Import Service screen, find the name of the relevant RPA process (e.g. “Fill Out Web Form”):

Click Next, give a name, and then reference the previously created Named Credential and click Next:

The next page is “Select Operations to Import”. Here, select 2 operations: “startProcessV2” and “getProcessesExecutionStatusV2”:

The startProcessV2 operation is used to kick off the process and the getProcessesExecutionStatusV2 is used to get the details of the kicked-off process (e.g. get the process success/failure status and the values of the RPA’s activity parameters).

Click Finish.

With this in place, this service can be referenced as an External Service from a Salesforce Flow:

## Salesforce – Create Flow to Kick off the RPA Process

### Create a Flow

Go to Setup -> Process Automation -> Flows -> and click “New Flow”:

This example will execute when a Quote object gets its Status changed to Presented. For this reason, this example will be a Record-Triggered Flow, with two branches.

The first will be a “Run Asynchronously” path which will be kicked off immediately upon the record update, and it will do an external callout to invoke the RPA process using data from the triggering Salesforce object. (Note: the path must be a “Run Asynchronously” path instead of a “Run Immediately” path because external callouts cannot run from within a “Run Immediately” path in a Salesforce flow.) The second will run 2 minutes later to check on the status and details of the triggered RPA process execution, and it will update the Salesforce object with that RPA output data.

The example case kicks off the RPA process whenever a Quote object enters Presented status, so the flow configuration is set up as follows.

Trigger the Flow When: A record is updated

Condition Requirements = All Conditions Are Met (AND)

The Condition is: Status Equals Presented

When to run the Flow for Updated Records = Only when a record is updated to meet the condition requirements

Optimize the Flow for = Actions and Related Records

Check the “Include a Run Asynchronously path to access an external system after the original transaction for the triggering record is successfully committed” box:

With this configured, click Save and name the Flow (e.g. “RPA Web Form Flow”:

## Implement “Run Asynchronously” Path

### Add a New Resource for RPA Invocation HTTP Request Body

This flow path will be used to invoke the RPA process, and the invocation will happen via HTTP call. The flow will set the HTTP request payload for that invocation (using data from the triggering object). For this purpose, a new variable is created.

Expand the Toolbox and click New Resource. Resource Type = Variable. Set API Name = RPAInputBody. For Data Type, select Apex-Defined. In Apex Class, search for the name of the External Service created earlier (e.g. “FillOutWebForm100”) because that is how the auto-generated Apex classes are named. Find the class ending in “ProcessExecutionWithExecutionID”. This is what holds the input payload to the RPA process (e.g. “ExternalService\_\_FillOutWebForm100\_ProcessExecutionWithExecutionID”):

### Add Assignment Element to Populate RPA Input Body

The RPAInputBody variable was created in the last step but not initialized with a value. To assign it a value, add a new step to the “Run Asynchronously” path. This step will be an Assignment. Set the Label = ‘SetRPAInput’ and then go down to the Set Variable Values section.

Set the RPAInputBody > executionId Equal to a relevant value that will serve as the unique identifier of the RPA process (e.g. $Record > Quote Number). This will be used later to check on the status of the executed RPA process.

The inputArguments will differ based on what the activity parameters are within the specific RPA process being invoked. In this instance, these values get set approximately as follows.

|     |     |     |
| --- | --- | --- |
| **Variable** | **Operator** | **Value** |
| RPAInputBody > executionId | Equals | {!$Record.QuoteNumber} |
| RPAInputBody > inputArguments > inputName | Equals | {!$Record.Opportunity.Account.Name} |
| RPAInputBody > inputArguments > inputAddress | Equals | {!$Record.Opportunity.Account.BillingStreet}, {!$Record.Opportunity.Account.BillingCity}, {!$Record.Opportunity.Account.BillingState} {!$Record.Opportunity.Account.BillingPostalCode} |
| RPAInputBody > inputArguments > inputEmail | Equals | {!$Record.Opportunity.Account.Owner.Email} |
| RPAInputBody > inputArguments > inputPhoneNumber | Equals | {!$Record.Opportunity.Account.Owner.Phone} |
| RPAInputBody > inputArguments > inputComments | Equals | {!Record.Description} |

The above values are what will be passed into the MuleSoft RPA process. Once this is set up, the RPA process can be invoked.

### Add Action Element to Invoke RPA Process

Add a new Action Element to the “Run Asynchronously” path. Search for the name of the External Service (e.g. “FillOutWebForm100”). Select the “Start Process V 2”) Action. Give it a Label and API Name (e.g. “RPAStartProcess”). Include a Body, and in the Body section, use the RPAInputBody created in the steps above. Click Done:

This completes the “Run Asynchronously” path.

Next, another path will be added to check the status of the executed RPA process instance and to update the triggering Salesforce object accordingly.

## Implement “Two Minutes Later” Path

### Add the “Two Minutes Later” Path

Add a new path to the flow which will run 2 minutes after the initial update. Path Label = TwoMinutesLater, Time Source = “When Quote is Updated”, Offset Number = 2, Offset Options = “Minutes After”:

With this path set up, it is now time to add elements.

### Add Action to Get RPA Process Execution Status

Add a new Action Element to the “TwoMinutesLater” path. Search for the name of the External Service (e.g. “FillOutWebForm100”). Select the “Get Processes Execution Status V 2”) Action. Give it a Label and API Name (e.g. “RPAGetStatus”). For the Execution Id, select the value used in the previous “Start Process V 2” action step for executionId (e.g. {!Record.QuoteNumber}). Click Done.

This step will check on the given RPA process execution instance and get its data back.

### Add Action to Update Triggering Record

Finally, the Quote should get updated with a value from the RPA process which was executed in the “Run Asynchronously” path. The prior step gathered the data via a call to the “Get Processes Execution Status V 2” endpoint. For this example, the Quote’s Customer Notes field will get updated with the outputFormResponse activity parameter value from the RPA process.

Add an element for “Update Triggering Record”.

Add a Label (e.g. “Update Quote with RPA Output”) and API Name.

Set How to find Records to Update and Set Their Values = “Use the quote record that triggered the flow”

Set Condition Requirements to Update Record = “None—Always Update Record”

Set Field Values for the Quote Record. (Note: this example will be specific to the Cloud First Labs use case). This example set agilqt\_\_customerNotes\_\_c equal to {!RPAGetStatus.200.result.oneOfOutputArguments.outputFormResponse}.

Click Save. The Salesforce flow is set up and ready to test.

To test it out, create a Quote. Make sure the fields are set as needed to be input into the RPA process. Then move the Quote into Presented status to trigger the flow. After running, the output can be checked in Postman to verify that the RPA process was triggered:

After the “TwoMinutesLater” path finishes, the Customer Notes should reflect the update provided back by the RPA process:

To see this in action, watch the video created to go along with this post:

Automate Your Salesforce Workflow: Effortless Web Form Filling Using MuleSoft RPA - Part 2 - YouTube

Tap to unmute

[Automate Your Salesforce Workflow: Effortless Web Form Filling Using MuleSoft RPA - Part 2](https://www.youtube.com/watch?v=68DGm4JbYM4) [CloudFirst Labs](https://www.youtube.com/channel/UC1sSMU1c7Ru-NmFS-aAdPLQ)

CloudFirst Labs202 subscribers

## Conclusion – Web Form Filling Using MuleSoft RPA

Yes, these two complementary posts were long but worth it!  Repeating it is easier once you build one of these processes and successfully test it.  Web Form Filling using MuleSoft RPA is just one of the many use cases where this technology really shines, and proves you don’t need an API-enabled application to use RPA.

## Talk to the Professionals!

## Overview – Web Form Filling Using MuleSoft RPA

There are numerous use cases that show how Organizations can commonly benefit from automating the completion of online Web forms. This post will show how simple it is to fill out Web forms using [MuleSoft RPA](https://www.mulesoft.com/platform/rpa), and in a subsequent blog article, I will show how to easily set up Salesforce to do this RPA-based form entry. ( [Salesforce](https://www.salesforce.com/products/sales-cloud/) will even get updated with the RPA process’s output data!) So join me as I walk you through the steps needed for Web Form Filling Using MuleSoft RPA Builder below.

## Set up Activity Parameters

Our example shows a process with 7 activity parameters; 6 of these are to be provided as inputs to the process, and 1 of them gets set as an output from the process. (An activity parameter can be used to serve input purposes, output purposes, both, or neither, but in this case, each one is useful specifically just for input or for output.) The values for these activity parameters can be defaulted from RPA Builder:

## Set XPath Variables

As shown in the screenshot above, my RPA process has a few XPath-related variables set. These XPath variables (nameXpath, emailXpath, etc.) hold the XPaths to navigate to a given field within a Web page. For some Web pages, these XPaths are easy to find and can even be done using RPA Builder’s handy Browser Wizard. For some Web pages with more complex UI’s (with a vastly complex set of HTML elements used to build out the screen), it may take some experimentation using Chrome Developer Tools to figure out the appropriate XPath to use to navigate to a given field on a Web page. An example Xpath variable value from the example RPA process is:

- nameXpath = //span\[text() = ‘Name’\]/parent::div/parent::div/parent::div/parent::div//input

These XPath-related variables are set so they can be used in later action steps: one step to clear any data out of said field, another step to write the new value into said field.

## Clear Web Elements

Now that the XPath elements are set up, add a “Clear Web Element” action step for every field that might need data cleared out. This can be important in case the field comes pre-populated for one reason or another:

## Click Web Element and Enter String

The next steps are to Click Web Element and Enter String. Click Web Element will bring focus to the relevant field (based on the XPath-related variable set earlier). The Enter String gets configured with the appropriate activity parameter value.

After doing this for each relevant field, it is now time to use one more Click Web Element to submit the Web form:

## Get Response Text

After clicking Submit, the RPA process gets taken to a new Web page. From this Web page, the RPA process will capture some text from the screen using a Get Web Element Text action step using XPath:

The following step is a Set Variable so that the value from that Web element can be set on an activity parameter (outputFormResponse, in this example’s case):

This sets the response on that activity parameter, allowing it to be referenced by invokers of this RPA process. (As we will see in Part 2 of this series, Salesforce \[or another system\] can kick off this RPA process and use the data from the outputFormResponse activity parameter).

After configuring this setup for the example Web form (and the input/output fields therein), the RPA process in RPA Builder looks like what is shown in the following screenshot:

## Conclusion – Part 1

By following this example, you can see how easy it is to complete Web Form Filling Using MuleSoft RPA and automate Web-based data input and output, especially when you want to set it up to write to or read from Web pages. By setting up such a MuleSoft RPA process as an invokable configuration (as shown [in an earlier Cloud First Labs post about MuleSoft RPA](/content/invoke-an-rpa-process-in-mulesoft-using-http-part-1/index.html)), another system can programmatically provide proper input to a Web form and utilize the output provided by the RPA process. Part 2 of this series will specifically show this capability by having a Salesforce flow use this example Web form RPA process.

A walk-through video demonstration of the steps I took can be found here on our YouTube channel:

Automate Your Salesforce Workflow: Effortless Web Form Filling Using MuleSoft RPA - Part 1 - YouTube

Tap to unmute

[Automate Your Salesforce Workflow: Effortless Web Form Filling Using MuleSoft RPA - Part 1](https://www.youtube.com/watch?v=N0OsPG7Btjc) [CloudFirst Labs](https://www.youtube.com/channel/UC1sSMU1c7Ru-NmFS-aAdPLQ)

CloudFirst Labs202 subscribers

## Talk to the Professionals!

## The Follow-Up: Why Even Invoke a MuleSoft RPA Process via HTTP?

As we learned in the first article in this series, many RPAs need to be callable via HTTP. In these such cases, the RPA process must be published to the Production phase with an invokable run configuration. Credentials (via a Connected App) must be created to authenticate to the RPA API URL and the URL must be retrieved from Anypoint Exchange. Those steps were covered in [Part 1](/content/invoke-an-rpa-process-in-mulesoft-using-http-part-1/index.html) of this 2-part series. The RPA API URL and API Key can be used in [Postman](https://www.postman.com/) to start the execution of the RPA process and to get the status and details of the process execution.

1. Get the RPA API URL from Exchange and the API Key from RPA Manager, per the steps in Part 1
2. Create and send a request in Postman to start the process execution
3. Create and send request(s) in Postman to get process execution status and details

## Start RPA Process Execution via Postman

Open Postman and create a PUT request to the URL copied out of Exchange in Part 1:

Next, go to the Authorization tab. Select Type = “OAuth 2.0”. In “Header Prefix” type “Bearer”. Leave the Token field blank initially; the following steps will go get a new token:

Scroll down to Configure New Token. In Token Name, enter whatever meaningful name you want to represent this OAuth access token. Select Grant type = “Client Credentials”. For the Access Token URL, type:” https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token”. In Client ID, paste the ID you copied from Anypoint Platform Access Management in Part 1. In Client Secret, paste the Secret that you copied in Part 1. Leave Scope blank, and for Client Authentication, set “Send as Basic Auth header”. Scroll to the bottom of the panel and click the “Get New Access Token” button:

This will use the provided Client ID and Client Secret to go get a new token from the provided Access Token URL. A Postman popup should show that the token was successfully generated and then show a screen for managing access tokens. It shows the access token value. Click Use Token:

Once the popup goes away, the token value is now being used in the request for authorization.

With a valid token in place, it is time to set up the actual request.

Go to the Body tab. Set it as a “raw” body and set the type = “JSON”.

In the body, specify an “executionId” and the values of any “inputArguments” that you want to set. The executionId is a unique ID that is used to find the status and output data of this specific RPA process execution (one executionId can only be used once). These inputArguments are the input values for the RPA process’s activity parameters; any values not set here are set to the default values configured in the Invokable Run Configuration set up in Part 1 of this series. After setting the payload, hit Send to fire off the request. If everything is configured correctly, a 201 Created status is returned. (Note: If you re-run the PUT command for the same executionId, these follow-up requests will receive 204 No Content statuses as responses, meaning that a new execution was not created.)

## Get RPA Process Execution Details via Postman

After sending the PUT request to kick off the RPA process, a GET request can be sent to get the status and details of that process’s execution. As shown in the Exchange page for this RPA process’s REST API asset, there is a GET endpoint for getting these details. The URL is the same endpoint as the prior PUT request URL, except it has “/<executionId>” appended to the end, where executionId equals the executionId sent in the prior PUT request.

After sending a PUT request for executionId = “CloudFirstLabs\_Test1”, send a GET request to …/executions/CloudFirstLabs\_Test\_1. The request should use the same access token as the prior PUT request (Authorization type = “OAuth 2.0”, select the token from the dropdown or paste the token value from the other request). The payload for this request is empty, as it is a pure GET command.

If this GET request is sent immediately after creating the process execution, the response’s message will probably say “The process execution is in status notStarted”.

If it is sent while the RPA process is executing, the response message will say “The process execution is in status running”.

If the GET request is sent after the RPA process executes successfully, the response message will contain a status of “success” and the result object will hold the values of the RPA process’s activity parameters.

## Conclusion

By using the steps from Part 1 and Part 2 of this series, we have shown how to enable a [MuleSoft RPA](https://www.mulesoft.com/platform/rpa) process invocation via HTTP and Postman.  This process can be applied to many scenarios and use cases.  Watch the second part of the video here:

Invoke MuleSoft RPA Process via HTTP and Postman Part 2 - YouTube

Tap to unmute

[Invoke MuleSoft RPA Process via HTTP and Postman Part 2](https://www.youtube.com/watch?v=pX5Yht4WMig) [CloudFirst Labs](https://www.youtube.com/channel/UC1sSMU1c7Ru-NmFS-aAdPLQ)

CloudFirst Labs202 subscribers

## Talk to the Professionals!

To learn more about our [MuleSoft RPA](/content/mulesoft/index.html) or [Salesforce](/content/salesforce/index.html) services, please visit our website or fill out a Contact Us form [here](/content/contact/index.html).

## Why Even Invoke an RPA process in MuleSoft using HTTP?

Simple!  Sometimes, it is required that a system Invoke an RPA process in MuleSoft using HTTP so that another system can call said RPA process. In such cases, the RPA must be moved into the Production phase and an Invokable Run Configuration must be configured for it in MuleSoft RPA Manager. After creating the invokable run configuration, the URL for invoking the RPA can be found in Anypoint Exchange. To keep everything secure, credentials will also need to be set up for authorizing the HTTP request to the API.

Given an RPA process that has successfully completed its test plans in the Test phase, follow the steps below to create an Invokable Run Configuration.

1. Create a Connected App that can invoke RPA APIs.
2. Promote the RPA process to the Production phase in RPA Manager.
3. Set up an Invokable Run Configuration.
4. Get the RPA’s URL from Anypoint Exchange.

Details on each of the steps above will be explained below.

## Create a Connected App

Log in to [Anypoint Platform](https://anypoint.mulesoft.com/) and navigate to [Access Management](https://anypoint.mulesoft.com/accounts). (This step requires the logged-in user to have Organization Administrator permission in Access Management.) From there, click Connected Apps in the left-hand panel. Then click the “Create app” button:

Enter a Name for the Connected App, and for Type, select “App acts on its own behalf (client credentials)” and click “Add Scopes”:

In the Add Scopes pop-up, find and select “RPA Invocable Process” and then click Next:

Select the Business Group(s) that the relevant RPA processes belong to and click Next. Then finally click “Add Scopes”:

Then click Save, at which point the Connected App is created. It should now show on the Connected Apps page, where you can click “Copy Id” and “Copy Secret”.  Be sure to save the Id and Secret values; these will be used later for invoking the RPA via HTTP call.

## Promote the RPA Process to the Production Phase

Promote the RPA process to the Production phase in RPA Manager. To do this, go to RPA Manager -> Process Automation -> Process Management. Select the relevant Category. Then select the relevant RPA process. Click the “Publish (Production)” button. In the pop-up window, check the checkbox to confirm the release of the process and click “Release to Production”:

## Create an Invokable Run Configuration

To set up an Invokable Run Configuration on an RPA process that is in the Production phase, navigate to that RPA process in RPA Manager. To do this, go to RPA Manager -> Process Automation -> Process Management, then select the relevant Category and Process. Then under “Production configurations”, select “Create an invokable run configuration”.

Enter a name and description:

Configure the default values for the process’s activity parameters:

Configure any needed user tasks:

Configure the Execution (“Run in secure session as default user” is recommended):

Configure the bot(s) for the process to run on:

And lastly, click “Save & Publish”.

## Get the RPA API URL from Anypoint Exchange

Upon creating the invokable run configuration for the RPA process, a “REST API” asset gets created in Anypoint Exchange. Within that asset, the URL can be found for invoking the RPA process via HTTP. To find the URL, navigate to Exchange. Then search for the name of the RPA (in my case, my RPA process is named “Get Widget Data from Legacy Inventory Site”) and select the asset with a matching name and a type = “REST API”:

After clicking the link to open the REST API asset, the asset’s Exchange page opens. Click on the second entry under Endpoints (the one starting with “/v2/”; this v2 URL is the one required for use with OAuth 2.0-based Connected App credentials we are using in this demo) in the left-hand panel to expand it.

Then click on the PUT startProcessV2 link:

After you do this, it will show a URL on the page:

This is the URL that will be used in Part 2 of this series to show how to use Postman to invoke the RPA process. Stay tuned for Part 2 next week!  Until then, watch the video version of this blog on YouTube:

Invoke MuleSoft RPA Process via HTTP and Postman Part 1 - YouTube

Tap to unmute

[Invoke MuleSoft RPA Process via HTTP and Postman Part 1](https://www.youtube.com/watch?v=ARRqxTJjG9U) [CloudFirst Labs](https://www.youtube.com/channel/UC1sSMU1c7Ru-NmFS-aAdPLQ)

CloudFirst Labs202 subscribers

## Talk to the Professionals!

## Overview

We know that RPA processes are excellent for automating screen work.  However, with [MuleSoft RPA](https://www.mulesoft.com/platform/rpa), they can be used to consume OAuth-Secured APIs and use data from the response! In this blog, I will show how to build a MuleSoft RPA process that successfully gets and uses data from an API that is secured in [Anypoint Platform](https://www.mulesoft.com/platform/enterprise-integration) by OAuth 2.0. \[Note: This approach works whether the OAuth-secured API is built in MuleSoft or another technology.\]

The key steps here are:

- Know the URL and credential details needed to get a valid OAuth token. (Assumed to be set up as a prerequisite)
- Know the URL and payload details needed to get a valid response from the actual API. (Assumed to be set up as a prerequisite)
- In MuleSoft RPA Builder, add activity parameters for the values mentioned in (1) and (2)
- In RPA Builder, add a REST Call for the OAuth token request.
- In RPA Builder, add a JSON Query action step to parse the access\_token from the response.
- In RPA Builder, add a REST Call for the actual API request (and reference the parsed access\_token).
- In RPA Builder, use JSON Query action steps to parse the relevant data from the API response.

## Primer on OAuth 2.0 and OAuth-Secured API

APIs secured by OAuth 2.0 require a valid access token to be sent as authentication and authorization, usually as an HTTP header. The OAuth 2.0 provider has a URL endpoint that provides a token when a requestor sends a valid request to the URL (with appropriate Client ID, Client Secret, grant\_type, and scope details). The token is usually valid to be reused for some arbitrary amount of time, such as one hour. But if no token is already cached, the token can be used as part of a two-step process for calling an API:

- Call OAuth Token endpoint with valid information to get back a valid access token.
- Put the token returned in (1) into an HTTP header and send a request with that header and appropriate payload to the actual API.

This two-step process is what will be used in this walkthrough.

## Add REST Call Step for 2 REST Calls in RPA Builder

\[Note: the following steps assume the OAuth and API details for your use case are set up and known in advance.\]

In RPA Builder, create activity parameters for the following fields.

- apiURL (alphanumeric Variable for the actual API URL to call)
- oauthTokenURL (alphanumeric Variable for the OAuth Token URL to call to get access token)
- oauthClientCredentials (User Account Variable for the Client ID and Secret for getting token)

Map those activity parameters to your workflow.

## Add a REST Call Step for Getting OAuth Token

Then, add a REST Call from the Toolbox for the OAuth Token call. Set it up as a POST request with no payload body. Map the oauthTokenURL as the Base Url.

Then go to the Header Parameter tab and the following headers:

Content-Type = application/x-www-form-urlencoded

Accept = \*/\*

Then go to the Query Parameter tab and map the following parameters:

grant\_type = client\_credentials

scope = myscope1 myscope2 (Your use case may differ; these are example scopes I set up for my example API)

Finally, go to the Authentication tab. Select Authentication Type = Basic Auth and map your oauthClientCredentials activity parameter to the User Account field. Click OK.

## Add JSON Query Step to Parse access\_token

Following this step, add a JSON Query action step from the Toolbox.

Configure the Json Object as the REST Call’s Response Body, and use a JSONPath Expression of $.access\_token to parse out the token value.

## Add REST Call Step to Call Actual API

Now that the access\_token has been generated and parsed, create a REST Call step to call the actual API.

Map the apiURL activity parameter to the Base Url field. The rest of the details on the Settings and Request Body tab are dependent on the specific API being called.

On the Authentication tab, set the Authentication Type as Bearer Token and map the Json Query FirstItem to the BearerToken field.

Click OK.

## Use JSON Query Step(s) to Parse Relevant Values from API Response

Like the section above used a JSON Query step to parse the access\_token value, JSON Query steps are also used to parse relevant values from the actual API response (assuming the API uses JSON). See the screenshots below to see how values were parsed from an example API.

Now you are able to capture the response!  While many steps, we have shown the power of using the above approach way to utilize API-based data inside a MuleSoft RPA process.  This is only one example of the limitless use cases that exist for this technology, and clearly shows how a customer can maximize their automation environment to do more than just screen work.  Check out the accompanying YouTube video on our channel:

Call an OAuth-secured API from MuleSoft - YouTube

Tap to unmute

[Call an OAuth-secured API from MuleSoft](https://www.youtube.com/watch?v=CLxJuY80eZg) [CloudFirst Labs](https://www.youtube.com/channel/UC1sSMU1c7Ru-NmFS-aAdPLQ)

CloudFirst Labs202 subscribers

## Talk to the Professionals!

## About Robotic Process Automation

Many organizations are searching for ways to reduce operational costs while increasing the accuracy, quality, and consistency of manually executed tasks. Robotic Process Automation (RPA) is a way to achieve these goals. RPA technology allows configurations of “bots” that mimic human-computer interactions to perform tasks at high volume and speed. Tedious, repetitive tasks and business-rule-driven processes are good candidates to be executed by RPA bots. These bots can extract data from applications and copy data between systems, even legacy applications and other systems that lack APIs.

[MuleSoft RPA](https://www.mulesoft.com/platform/rpa) is a powerhouse RPA technology platform that enables organizations to take advantage of the benefits of automation. MuleSoft is a longtime leader in integration technology and has built MuleSoft RPA to extend solutions even to systems with insufficient traditional integration solutions (such as Web Services or APIs). On top of its integration expertise, MuleSoft comes with the added benefit of being a [Salesforce](https://salesforce.com/) company. The Salesforce backing means MuleSoft RPA customers can count on quality support from the Salesforce organization and experienced Salesforce-partnered strategic implementors.

With its toolset of RPA Recorder, RPA Builder, RPA Manager, and RPA Bots, MuleSoft RPA makes automation development straightforward to build, to maintain, and to execute. Whether a given RPA process needs to run once, run regularly on a schedule, or run dynamically via HTTP request, MuleSoft RPA can set up the processes as required. MuleSoft RPA enables organizations to connect difficult-to-integrate systems, to reduce monotonous work, and to improve quality of business operations.

## Automating Repetitive Tasks

RPAs are effective across a variety of industries. They are especially useful for automating “swivel chair tasks”. Swivel chair tasks are processes that are carried out by employees manually entering the same data into multiple systems, often toggling between tabs, applications, or terminals to do so. This type of work tends to feel a little “brainless”. This is often uninspiring to the employee(s) and it can lead to employee dissatisfaction. Many of these boring repetitive processes are error-prone due to the manual and repetitive nature of work.

RPAs can even the speed of execution for these processes. RPA bots can often be configured to carry out their specific work much more quickly than a human visually and manually working through a process. And since the RPAs can be triggered automatically, the processes do not need to wait for the availability of the employee. Pushing the work to the RPA bot allows the workflow to quickly reach its next relevant step while the employee is freed up to perform more engaging and higher-value work.

Many legacy systems utilized by organizations require significant amounts of swivel chair work. Legacy systems often lack API capabilities or have APIs insufficient for the business needs of a given organization. Often, the organization is dependent on such legacy systems anyway and employees do tedious data scraping and copy/paste tasks to and from these systems. This work is vital to an organization’s business needs but is burdensome based on the manual efforts required. RPAs can be used integrate these key legacy systems with more modern systems in an automated and robust fashion, paving the way for innovation and more efficient processing. Serving as a bridge from legacy to more modern applications, RPAs can play an important role in an organization’s digital transformation strategy.

## Cloud First Labs’ Recommended Solution: MuleSoft RPA

At Cloud First Labs, we recommend using MuleSoft RPA to take care of organizational automation needs. It is backed by technology industry leaders, it supports the entire automation lifecycle, and its set of tools plugs in seamlessly to integrated, modernized environments. MuleSoft RPA provides outstanding solutions for eliminating waste and gaining technological efficiencies throughout an organization’s business processes.

## MuleSoft RPA: Backed by Industry Leaders

MuleSoft RPA is built by MuleSoft, which has been a leader in the integration software industry since its founding in 2006. MuleSoft has developed a top-tier integration platform as a service (iPaaS): Anypoint Platform. The Gartner Magic Quadrant for Integration Platform recognizes MuleSoft as a leader in the integration world, and MuleSoft’s RPA Manager and associated tools fit right into the award-winning Anypoint Platform. With MuleSoft long recognized as a leader in integration technology, MuleSoft RPA provides yet another tool for ensuring businesses can connect with and integrate all sorts of disparate systems to accomplish business processes as effectively as possible.

The MuleSoft support process is a crucial part of MuleSoft’s success, and that support is available to MuleSoft RPA users the same way it is available to users of MuleSoft’s other myriad of products and services. The same way MuleSoft’s products help systems connect with other systems across the world, their support team likewise connects worldwide customers with the support they need. With a large and helpful team of support staff scattered across several continents, MuleSoft has the organizational infrastructure in place to provide effective support promptly regardless of what the issue is, when it happened, or where the event took place.

Part of the reason for MuleSoft’s trustworthiness and success is the fact that it is a Salesforce company. Salesforce acquired MuleSoft in 2018 and it has helped grow and deepen MuleSoft’s documentation, support, and capabilities. Salesforce was selected as the Best Software Company in 2024 by G2. With MuleSoft’s deep roots in integration and Salesforce’s backing and support, customers can be confident that their experience with MuleSoft RPA will be best-in-class.

## MuleSoft RPA: Supports Whole Automation Lifecycle

There are several phases to the process automation lifecycle, MuleSoft RPA provides a full framework of tools that enable organizations to perform every aspect of it. From Evaluation to Design to Build to Test to Production (Deploy and Monitor), MuleSoft RPA ably provides useful and fully-featured tools.

Tasks and business processes should initially be vetted to see whether they are a good fit for automation. MuleSoft’s RPA Manager can be used to help identify whether a given process is a good candidate for automation. Out-of-the-box functionality includes industry-standard settings for evaluation, but it allows for customization specific to organizational needs. Furthermore, the RPA Manager provides tooling to help determine the break-even point for when a given automation becomes profitable.

The design phase is important for budding RPA processes; this is where the overall approach and flow are identified and visually illustrated. RPA Manager is used in this phase to build out a design diagram using industry-standard Business Process Model and Notation (BPMN). The BPMN diagram built in RPA Manager can be used in RPA Recorder which is useful for “recording” a user’s actions on a computer as they work through a given business process. In RPA Recorder, the actions taken by the user can be fit into the relevant components of the BPMN diagram and documentation can be captured at each step along the way for later use in the Build phase.

MuleSoft RPA’s tool for the Build phase is the aptly named RPA Builder. In RPA Builder, the development of the actual RPA work is completed. Using the aforementioned BPMN diagram and/or the documentation and workflow steps generated by RPA Recorder, RPA Builder takes the output of the design process and turns it into the actual steps to be completed by an RPA Bot. RPA Builder is where the exact steps to be executed by eventual RPA bots are configured; this is where the instructions for the bot to “click here” or to “enter XXX text here” are set up. RPA Builder has a vast toolbox of options that allow for nearly any type of on-screen activity to be configured: from clicking to parsing Web pages to scraping text via Optical Character Recognition (OCR), and beyond. RPA Builder enables the builder to not only build bot instructions but also debug and test them. In RPA Builder, input data and output data (both represented as Activity Parameters) can be configured to ensure the RPA process receives and returns appropriate data.

MuleSoft RPA Builder tool

After publishing an RPA process built in RPA Manager, the RPA process moves from the Build phase to the Test phase. The Test phase is vital to the lifecycle of an RPA process, and it requires two main components of MuleSoft RPA: RPA Manager and one or more RPA Bots. An RPA Bot is a Windows computer or VM configured to be able to run MuleSoft RPA processes. RPA Manager is used to configure test plans and to determine which RPA Bot(s) to execute a given test plan on.

Once the RPA process has been suitably tested, it is ready to move to the Production phase. Similar to what gets configured in the Test phase, this configuration uses a combination of RPA Manager and RPA Bots. RPA Manager sets up the schedule or invokable nature of the relevant RPA process and it provides configurations for default Activity Parameter values and for the RPA Bot(s) the process will get deployed to. Upon execution of the deployed processes, the executing RPA Bots provide ample data back to the RPA Manager for monitoring (including near-real-time screen look-ins), for checking success/failure status, and for troubleshooting.

Deploy a bot using the MuleSoft RPA manager

Evaluation, build, design, testing, and production are all important phases of building RPAs. No matter what part of the RPA process is involved, MuleSoft RPA has tooling to support organization automation success.

## MuleSoft RPA: Seamlessly Plugs into Integrated Environment

MuleSoft RPA does not operate in a silo; it can seamlessly tie into various technology environments and platforms. While there is special tooling that makes MuleSoft RPA even easier for existing MuleSoft or Salesforce customers, MuleSoft RPA can be readily utilized in a wide variety of environments.

Production-phase MuleSoft RPA processes can be invoked via HTTP API calls if configured in such a way, that if an outside system needs to trigger an RPA process, it just calls the generated RPA API URL generated by RPA Manager (found in Anypoint Exchange). Anypoint Platform’s API Manager can be used to secure this RPA API URL. In cases where other systems cannot invoke an RPA process, RPA Manager enables the process to be scheduled to run on a specific frequency. This is useful in cases where a given process should be run consistently (whether hourly, daily, weekly, etc.).

Not only can RPA processes be triggered by an API call, but RPA processes can call other APIs as well. As part of the Toolbox in RPA Builder, RPA processes can make outbound API calls and use the returned data.

The ability of RPA processes to be called as APIs and to call other APIs helps bring otherwise disparate manual processes into an overall flow. These abilities provide a way to combine automated data transfers with “manual” clicks seamlessly into an integrated process to operate a business efficiently and effectively.

## Closing

Organizations are dealing with inefficiencies and problems related to the manual completion of repetitive tasks, to double data entry, and to legacy system integration. MuleSoft RPA is backed by industry leaders MuleSoft and Salesforce (and supported by an ecosystem of Salesforce partners like us at Cloud First Labs) and provides solutions. From RPA process evaluation through process monitoring, MuleSoft RPA provides a wide array of tools that enable organizations to implement high-quality automations.

## Talk to the Professionals!

To learn more about our [MuleSoft RPA](/content/mulesoft/index.html) or [Salesforce](/content/salesforce/index.html) services, please check out our website or fill out a Contact Us form [here](/content/contact/index.html).

## Why Use MuleSoft RPA?

For the first blog post in our series “Solving Data Collection and Processing Challenges using Salesforce and MuleSoft RPA”, we’re addressing a common scenario, getting data from a web page or HTML.  Whether or not you are on the [Salesforce](https://www.salesforce.com/) platform, you will want to use [MuleSoft RPA](https://www.mulesoft.com/platform/rpa).  The speed, ease of use, feature set, and interoperability with other platforms make it the Go-To choice for us.

In many Use Cases we see with customers, there is a requirement to build Robotic Process Automations (RPA) that iterate over data of unknown length inside a Web browser or from a web page. Consider the scenario where a customer needs an automated process to find all Widget Names on an inventory Web page where Build Category = “Boom Box”.

Widget data table

The process does not know how many records are going to be on the page during any specific RPA execution instance, nor does it care.  As long as it finds the Build Category that it is looking for, everything will work.

## How to get it done.

To iterate over this data in [MuleSoft RPA Builder](https://www.mulesoft.com/platform/rpa-builder), simply use a For Loop with a Managed Block inside of it which breaks out of the loop once an iteration is reached with no data found. To do this:

- Open a Web Session. Inside of this Web Session, add a Loop element with a very high number of iterations (more iterations than will be realistically encountered). Inside the Loop element:
  - Place a Managed block
  - Inside the DoAction section of the Managed block:

- Add a “Combine Strings” element to generate an XPath to the relevant data using the loop iteration number)
- Add a Get Web Element Text element which uses the prior-generated XPath to find the relevant data

- Inside the OnError section of the Managed block:

- Add a “Force OK State” element
- Add a “Break Loop” element
- Note: This “OnError” section of a Managed block is the equivalent of the “catch” section of a Try/Catch block in regular programming
- Note: This OnError section will get called the first time there is nothing found for the XPath defined in the DoAction section. So if there are 4 records, and the XPath looks for the 5th record, it will fail and the execution will flow into this OnError section.

Build your MuleSoft Workflow like this

In the above example, the Combine Strings element is configured as follows. Pattern = (//tr\[td\[text() = ‘Boom Box’\]\]/td\[1\])\[{1}\] (where {1} is the loop iteration)

Combine Strings Wizard

Next, the Get Web Element Text element is configured as shown below, referencing “XPath to Widget Name.Combined String”:

Use the Get Web Element Text Wizard

Using this pattern and this Kickstarter, you can adapt the above approach as necessary for your use case.

## Conclusion

While this is a very simple example, we have illustrated the power and potential of MuleSoft RPA.  With this article as a guide, it is simple to iterate over Web data tables of unknown length using MuleSoft RPA.  You can watch the video on YouTube here:

Iterate Over HTML Data in MuleSoft RPA - YouTube

Tap to unmute

[Iterate Over HTML Data in MuleSoft RPA](https://www.youtube.com/watch?v=renB4i2mRRc) [CloudFirst Labs](https://www.youtube.com/channel/UC1sSMU1c7Ru-NmFS-aAdPLQ)

CloudFirst Labs202 subscribers

## Talk to the Professionals!

To learn more about our [MuleSoft](/content/mulesoft/index.html) or [Salesforce](/content/salesforce/index.html) services, please check out our website or fill out a Contact Us form [here](/content/contact/index.html).

reCAPTCHA

Recaptcha requires verification.

protected by **reCAPTCHA**
