This guide will teach how to update a table based on a condition. If the condition is true, the record will be updated. If it is false, a new record will be added.
- Okta Workflows
The table has two columns: Product and Access counter.
The flow below will search the table for a product. If a product is found, the Access counter is updated. If a product is not found, a new record is added to the table.
The above flow has the following steps:
- The Helper Flow card provides input to the flow. It is possible to enter a product in the table or a new product.
- The Tables – Search Rows card searches the table for the entered product. It returns the Row ID field.
- The Branching – If/Else card determines if the product is in the table or a new product.
- If the Row ID is not empty, a product is found (yellow section).
- Using the Tables – Update Row card, update the record by increasing the Access counter column by 1.
- The Compose card creates a message for the If/Else card output (for update condition)
- If the Row ID is empty, it is a new product.
- Using the Tables – Create Row card, add a new product record to the table.
- The Compose card creates a message for the If/Else card output (for new record condition).
- If the Row ID is not empty, a product is found (yellow section).
The Branching – If/Else card condition editing:
Clicking on the arrow pointing icon will open the following view to edit the condition:
Running the flow with input Bread results in a record update:
After the run, the Access counter for Bread is updated:
Running the flow with input Cheese results in a new record:
After the run, the table has a new product record:
