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 and Invoke MuleSoft RPA Process via HTTP and Postman Part 2.
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, 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). 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:
Talk to the Professionals!
To learn more about our MuleSoft IDP, MuleSoft RPA, Partner Manager and EDI, or Salesforce services, please visit our website or fill out a Contact Us form here.