Use Case: Save Data After Iterating on Invoices
In this use case, an organization 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 identifies the invoice numbers to cancel by generating a report.
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. However, an integration can't perform this task. Here's why: The REST APIs for the application don't allow you to select 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
See Create a Data Type. |
Define the trigger |
Define the trigger's input
The input allows the robot to receive a list of invoices from an integration. 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 and pass it back to an integration:
|
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
See Create a Variable. |
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 data stitch contains the following operations:
|