Pre-General Availability: 2024-09-02
Use Case: Save Data After Iterating
A robot must manually cancel a set of invoices and obtain the invoice number and status for each invoice. Explore how a foreach loop and the data stitch action support this workflow.
Scenario
You must periodically cancel a number of invoices. An integration generates a report that finds the invoices that need canceling. The report provides the invoice numbers of the invoices that need canceling in an XML response.
The robot completes the following tasks:
-
Cancels a set of invoices one by one.
-
Obtains the invoice number and status for each canceled invoice.
This use case focuses on how you use the data stitch action to obtain the invoice number and status from each invoice. For information about how to update a set of invoices, see Use Case: Update a Set of Invoices.
Why Create a Robot?
An integration provides improved scalability over a robot for work like this, but you cannot design an integration to cancel the invoices. Here's why: The REST APIs for the application don't allow you to select only invoices of a specific type, and you must cancel invoices with a specific invoice type. Therefore, a robot is the ideal solution for automating this manual, repetitive task.
Workflow
Requirement | How to meet the requirement |
---|---|
Create the data types for the trigger |
Define the data type for the input:
Define the data type for the output:
|
Define the trigger |
Define the trigger's input:
The input allows the robot to receive a list of invoices from the integration that calls the robot. For example, the robot might receive the invoice numbers for 20 invoices. Define the trigger's output:
The output allows the robot to collect the following information so that it can pass the information back to the integration:
The output collects information for multiple invoices, so it must be a collection. |
Define the variables |
Define a variable to hold the number of each updated invoice:
Define a variable to hold the status of each updated invoice:
|
Within the robot, add a foreach loop and a data stitch action within it |
When a robot must perform the same work on multiple items, define the robots actions in a foreach loop. This use case is focused on the tasks that you perform in the data stitch and doesn't provide details about all of the actions in the foreach loop. For a use case that focuses on how to update a set of invoices, see Use Case: Update a Set of Invoices. The foreach loop might look something like this: |
Define the details of the data stitch |
The following foreach loop contains the following operations:
|