Create an Automation to Trigger Technical Events
- How to design an automation that will retrieve order details from an application and read them on excel.
- Step 1
Now you will create your automation.
In the Overview of Build Process Automation, choose Create and select Automation.
In the Create Automation window, name the automation Get Order Details Assistant, add a description and choose Create.
You will be navigated to the Get Order Details Assistant page.
- Step 2
You will now create a User Task that will prompt you if you want to retrieve the details on an excel sheet.
Navigate back to the Overview tab, choose Create and User Task.
In the Create User Task window, under the Name field enter Order Details Assistant.
You can enter a description and choose Create.
You will be navigated to the User Task you just created.
You can now drag and drop components to build your user task. Drag and drop the component Title.
Select the title and enter the following question: Do you wish to retrieve the order details in an Excel worksheet? under the text field, then select the text in quotation marks and hit enter.
Choose + Click to Add a Reject Decision.
Now you have a Continue and Reject button. Choose Save.
- Step 3
You will now design the automation Get Order Details Assistant.
Navigate back the Overview tab, choose Get Order Details Assistant.
You will be navigated to the automation page where you can start dragging and dropping activities into the workflow.
In the Automation Details panel, under User tasks, choose the Order Details Assistant user task you just created and drag and drop it into the workflow.
Now search for the Log Message activity and drag and drop it into the workflow.
Select the Log Message activity. Under Input Parameters, select
1 decision
as message.This refers to the decision made: either Approve or Reject.
Search for the Condition control and drag and drop it into the workflow.
Select the Condition control and under the Condition Expression, choose the three dots to edit the formula.
Select the decision variable and add == “approve”.
Choose Save Expression.
This means that if the decision approve is selected, the bot will retrieve the details in an excel spreadsheet.
Search for the Log Message activity and drag and drop two Log Message activities under the first and second branch of the Condition.
Now select the first Log Message and under the Input Parameters as a message, enter Confirmed and select the text in quotation marks and hit enter.
Do the same for the second Log Message but this time enter Declined as a message under Input Parameters.
Change the names of the Log Message step names to Log Message - Confirmed and Log Message - Declined.
- Step 4
Now you will add the screen you captured. Under Automation Details, choose Screens and select Order Details.
Drag and drop the screen into the workflow, just below the first condition branch.
You will now drag and drop the activities you want your automation to perform to the corresponding element you previously declared on the screen.
For instance, you will drag and drop three Get Element activities to get the Customer Name, the Order Amount and Order Reference.
Double click on the Order Details screen, under the Screen panel, search for the Get Element activity.
Drag and drop it on the Customer Name element you previously declared.
Under Get Element activity, set the Output Parameters to
5 customerName
.Now perform the same for Order Amount and Order Reference, setting the Output Parameters to
6 orderAmount
and7 orderReference
respectively.Save your work.
- Step 5
Now you will create the Shipping Address Group that will group all the Shipping Address details.
Click on the canvas to go back to the Automation Details. Search for the Group control and drag and drop it into the workflow just below the Get Element Order Reference activity.
Select the Group control and change the Step Name to Group Shipping Address.
You may change the color of your Group so it stands out in the workflow.
Double click on the Order Details screen on your workflow.
Now you will get the elements corresponding to the Shipping Address details.
Search for the Get Element activity and drag and drop it on the Shipping Address Name element on the screen.
Set the Output Parameters to
8 addressName
.Drag the Get Element Shipping Address Name activity and put it in the Group Shipping Address.
Now perform the same actions for :
- Shipping Address Street, setting the Output Parameters to
9 addressStreet
. - Shipping Address Zip Code city, setting the Output Parameters to
10 addressZipCodeCity
. - Shipping Address Region, setting the Output Parameters to
11 addressRegion
. - Shipping Address Country, setting the Output Parameters to
12 addressCountry
.
- Shipping Address Street, setting the Output Parameters to
Save your work.
This is the expected result of your Automation at the end of this step:
- Step 6
You will now add the excel template to your artifacts.
Go back to the Overview tab.
Choose Import and then File.
Fill in the Import File window.
Choose Import.
The file has been imported successfully.
Check File is active, this way you may use it in your automation.
Choose Save.
If you go back to the Overview tab, you will see that the file has been added as an artifact.
- Step 7
You will now create the Excel Group that will group all the excel activities that are necessary to retrieve the order details into an excel spreadsheet.
Go back to the automation workflow. Under Automation Details, search for the Group control.
Drag and drop it into the workflow just below the Group Shipping Address.
Select the Group control and change the Step Name to Group Excel.
You may change the color of your Group so it stands out in the workflow.
Under Automation Details, search for the Open Excel Instance activity.
This is a mandatory activity when using MS Excel, it opens an instance of MS Excel. Once you open an Excel instance, you can start using other MS Excel activities.
Drag and drop it into the workflow inside the Group Excel.
Now search for the Open Workbook activity and drag and drop it in the Group Excel under Open Excel Instance.
Select the activity and under Input Parameters, choose the pencil icon next to the
workbookPath
field.Edit the Expression to:
irpa_core.enums.path.files + '/OrderDetailsAssistant.xlsx'
Choose Save Expression.
This action opens the excel template that was just imported so that it can receive the details that need to be set in it.
This is the excel template Order Details Assistant that was just imported. You will now set the values of a specified cells range (order details) in the worksheet: Customer Name (E6), Order Amount (E7) and Order Number (E5).
Under Automation Details, search for the Set Values (Cells) activity.
Drag and drop it into the workflow under the Open Workbook activity.
Select the activity and change the Step Name to Set Values - Customer Name.
Under Input Parameters, set the range Definition to E6 and select the text in quotation marks.
For the values select
5 customerName
.Now perform the same actions using the details in the table below :
Activity Step Name range Definition values Set Values Set Values - Order Amount E7 6 orderAmount
Set Values Set Values - Order Reference E5 7 orderReference
Save your work.
At this step, your automation should look like this :
- Step 8
Now that you have set the values for Customer Name, Order Amount and Order Reference, you will set the values for the Shipping Address Details.
Under Automaton Details, search for the Group control.
Drag and drop it into the workflow in the Group Excel just below Set Values-Order Reference activity.
Select the Group control and change the Step Name to Group Shipping Address Details.
You may change the color of your Group so it stands out in the workflow.
Search for the Set Values (Cells) activity.
Drag and drop it into the workflow inside the Group Shipping Address Details.
Select the activity and change the Step Name to Set Values - Address Name.
Under Input Parameters, set the
rangeDefinition
to D12 and choose the text in quotation mark.For the values, select
8 addressName
.Now perform the same actions using the details in the table below :
Activity Step Name range Definition values Set Values Set Values - Street D13 9 addressStreet
Set Values Set Values - Zip Code City D14 10 addressZipCodeCity
Set Values Set Values - Region D15 11 addressRegion
Set Values Set Values - Country D16 12 addressCountry
Save your work.
At this step, your automation should look like this :
- Step 9
You will now retrieve the values in the Line Items table and set them in excel.
Under Automaton Details, search for the Group control.
Drag and drop it into the workflow in the Group Excel just below the Group Shipping Address Details.
Select the Group control and change the Step Name to Group Line Items.
You may change the color of your Group so it stands out in the workflow.
Double click on the Order Details screen to have a view of the screen.
Under the Screen panel, search for the For Each control.
Drag and drop the control on the Table Data that you previously declared.
Select the Item: Table Data.
Two For Each loops are created because the Line Items table is two dimensional.
Drag the For Each controls inside the Group Line Items.
Change the Step Names of the first For Each loop to: For Each Line Items Row and the second loop to: For Each Line Items Data.
Now you will get the item values inside the table. To do so, search for a Get element activity.
Drag and drop it into the workflow, just below the For Each Line Items Data.
Change the Step name to Get Line Items.
Under Parameters select the Target
24 currentMember
.For Output Parameters, change the text to
25 tableData
.Now under Automation Details, search for the Condition control.
Drag and drop it into the workflow just below the Get Line Items activity.
Select the Condition to set the parameters.
Choose the three little dots next to the Condition Expression field and then Edit Formula.
Set the value of the Edit Expression window to
Step24.index === 0
.Choose Save Expression.
Now choose Add Condition to add another condition.
Choose the three little dots next to the Condition Expression field and then Edit Formula.
Set the value of the Edit Expression to
Step24.index === 1
.Similarly, add 2 other conditions with the following values:
Step24.index === 2
Step24.index === 3
Save your work.
Please make sure not to copy and paste the above values directly in the Condition Expression field but to follow the steps mentioned above.
The last step will be to set these Line Items values in the Excel spreadsheet.
To do so, under Automation Details, search for the Set Values (cells) activity.
Drag and drop the activity into the workflow, just below the first condition.
Now select the activity and change the Step name to Set Product Name.
Under Input Parameters, choose the three dots next to range Definition.
In the Edit Expression window, set the following expression:
"B" + (Step23.index + 23)
Under Input Parameters, set the values to
25 tableData
.Save your work.
You have set the values of the Product Name into the excel spreadsheet. Now you will do the same for the other Line Items such as Unit Price, Product Quantity and Total Price.
Similarly, drag and drop Set Values (Cells) activity under each condition branch.
Now perform the same actions using the details in the table below :
Activity Step Name range Definition values Set Values Set Unit Price "C" + (Step23.index + 23)
25 tableData
Set Values Set Product Quantity "D" + (Step23.index + 23)
25 tableData
Set Values Set Total Price "E" + (Step23.index + 23)
25 tableData
Please make sure not to copy and paste the
rangeDefinition
values directly in the field but to follow the steps mentioned above.
- Step 10
The last step consists in saving the workbook you created and releasing the excel instance.
To do so, under Automation Details, search for the Save Workbook activity.
Drag and drop the activity into the workflow in the Group Excel just below the Group Line Items.
Under Input Parameters, fill in the file Path field with the destination you wish to save your workbook.
Now search for the Release Excel Instance activity.
Drag and drop it into the workflow, just below Save Workbook activity.
Save your work.
This is what your final automation should look like:
What activity sets the values into an Excel spreadsheet?
- Create the automation
- Create the user task
- Design the automation - Add user task and set condition
- Design the automation - Add the captured screen and get the order details
- Design the automation - Get the shipping address details
- Import the excel template
- Design the automation - Set the order details in excel
- Design the automation - Set the shipping address details in excel
- Design the automation - Get and set the line items in excel
- Design the automation - Save and release