
Lab 6: Invoke Published Document Action within an RPA Automation
Overview
In this lab you’ll learn how to invoke, from an RPA automation, an IDP Document Action previously published to RPA.
As part of the exercise you’ll start from a pre-drafted automation and you’ll be asked to complete it. The automation polls an email inbox for a new email and when founds an email sends (POST) the attachment to IDP. The application then polls for the results every 5 seconds and once available prints them out.
Following you see the drafted automation you’ll be working on.

Prerequisites
If you didn’t complete Lab 1: Process an Invoice with MuleSoft IDP , in order to be able to consume the NTO Invoice Document Action in RPA, you have two options:
-
Use the document action published by one of the other workshop attendee.
-
Quickly create a new <your-initials>
- NTO Invoice
document action (leave everything set to the default) and publish it to RPA.
Step 1: Create and Release a New Process up to the Build Phase
-
Logon to your MuleSoft RPA Manager instance.
Expand the
Process Automation
menu and click onProcess Management
-
Click on your workshop category to start building your new Automation process.
-
Once in your category, click on the
Create
button -
Use the following pattern for the process name:
<your-initials>
- IDP Module - Process Document with IDP
Scroll down and uncheck the
Use Process Board
option (we will not use the Process Board capabilities on this workshop).Click
Save
on the bottom right to create your new automation process.Open your new process by clicking on its name
Every new process starts on the
Design
phase. On this module we will not cover it so we need to move it forward to the next one:Build
-
To move forward the current process phase, click on the
Publish
button: -
Every time a process is moved forward its following phase, a confirmation popup window is shown. Check the confirmation option and click the
Release to Build
button: -
Now the process is in Build phase and ready to be implemented with the MuleSoft RPA Builder tool
Step 2: Download and Open the Process with RPA Builder
-
Once RPA Builder is opened, click on the
Repository Explorer
tab. The explorer, you should see a number of processes that are currently inBuild
phase. Locate your process and double click to open it.If the
Repository Explorer
tab is not displayed, you can always enable it by going to theView
menu and clicking onShow Repository Explorer
: -
After double clicking your process, it will be downloaded from the server and stored locally in the Windows box.
-
If a dialog box pops-up asking to change the resolution, click
Yes
-
Step 2: Import a Pre-drafted Process
-
From the Windows VM, download the
Module_IDP_Lab_6.crpa
file containing the drafted automation.You should have the Google Drive link sent to you along with the credentials and other workshop material. This drive contains the student files and solutions for all Labs. If you do not have access, ask the instructor.
-
In RPA Builder, click the
Import Project
option under theFile
menu: -
Click
Yes
to Confirm project will be overwritten dialog, locate your just downloaded.crpa
file and clickOpen
to import it.
Step 3: Configure the Imported Process
-
Locate and click the Business Process Initialization button at the top right of the Canvas and click on the Activity Parameters link:
-
Update the mail settings with values provided by the instructor. Only the mailCredentials password should be missing.
-
Update the idpConnectApp Client ID & Client Secret, provided by the instructor
-
Double-click on the existing Check Email activity and its configuration window will be opened below:
-
Double-click on the Read Email element.
-
Update (replace CC with yours initials) the subject email filter with this pattern <your initials>-.

Step 4: Post Document to IDP
-
Double-click Process Document with IDP activity and its configuration window will be opened below:
-
In RPA Builder, click the
Show Toolbox
option under theView
menu: -
From the toolbox, locate and drag the Submit Document to MuleSoft IDP action step to the Activity Workflow workbench
-
Double-click the Submit Document to MuleSoft IDP element
-
Assign the Execution ID to the Activity Parameters→idpExecutionId
-
Select
YOUR
Document Action for the Action and leave the default version -
For Directory Path click the Push Pin and select the Activity Parameters→attachmentsTemporaryFolder
-
For File name, click the Push Pin and select the Activity Parameters→attachmentFilename
-
Set the Connected App Credentials to the Activity Parameter→idpConnectedApp
-
Click OK
-

Step 5: Get IDP Results
-
Double-click Retrieve IDP Processing Results activity and its configuration window will be opened below:
-
From the toolbox, drag the Retrieve Results from MuleSoft IDP action step to the Activity Workflow workbench
-
Double-click the Retrieve Results from MuleSoft IDP element
-
Assign the Execution ID to the Activity Parameter idpExecutionId
-
Select your Document Action for the Action and leave the version as the default
-
Set the Connected App Credentials to the Activity Parameter idpConnectedApp
-
-
From the toolbox, drag the Set Variable action step to the Activity Workflow bench under the Retrieve Results from MuleSoft IDP element.
-
Double-click the Set Variable element.
-
In the Name field type Set IDP Status.
-
For the Variable field select the Activity Parameter idpStatus.
-
For the Value field, click the push pin and select Retrieve Result from MuleSoft IDP→Status.
-
Click OK.
-
-
From the toolbox, drag the Json Query action step to the Activity Workflow below the Retrieve Results from MuleSoft IDP element
-
Double-click the Json Query element
-
In the Name field type Get Invoice Number
-
Set the Json Object to Retrieve Results from MuleSoft IDP→Json Result.
-
For the JsonPath Expression click the braces { }
-
Click Import from file and navigate to the Module_7_files folder and select the IDP_Sample_Output.json file
-
Click Next.
-
You will be shown a sample output
-
Click "value" under "invoiceNumber", this should auto-populate the
JSONPath Expression
field with$.pages[*].fields.invoiceNumber.value
and theResult
field with100
-
Click Next, then click Apply, then click OK in the Json Query Wizard.
-
-
Repeat steps 9-13 for Invoice Date, Invoice Purchase Order, Invoice Due Date and Invoice Total.
-
From the toolbox, drag the Set Variable action step to the Activity Workflow workbench below the Get Invoice Total element.
-
Double-click the Set Variable element.
-
In the Name field type Set Invoice Number
-
For Variable select the Activity Parameter, Invoice Number
-
For the Value, click the push pin and select Get Invoice Number→FirstItem
-
Click OK.
-
-
Repeat steps 15-16 for Invoice Date, Invoice Purchase Order, Invoice Due Date and Invoice Total.

Step 6: Test the automation
-
In the BPMN editor panel click Run Process icon. This will start the automation.
-
Activities 1 and 2 will run through completion. Activity 3 will show
Please complete the User Task
dialog box. -
Open chrome and navigate to https://anypoint.mulesoft.com/idp/tasks. Login using the credentials provided by the instructor.
-
Under Review Tasks find
YOUR
document and select it. This should show your Invoice in the preview panel and paymentTerms in the Results panel. -
Review the Results panel and verify the accuracy. Click Submit and Done.
-
Go back to the User Task dialog box and click OK. This will continue the automation.
-
-
A Message Box will be displayed with the extracted data from the Invoice. Wait for it to timeout or click Close..
-
The automation is complete, click Close in the Test run information dialog box.
