How to Conditionally Update a Table in Okta Workflows

In this guide:

  1. Okta Workflows guides
  2. Conditionally updating a table
  3. Related Workflows guides
  4. Workflows resources

Okta Workflows guides

Okta Workflows guides are questions and answers from the community office hours, the #okta-workflows channel on MacAdmins Slack, and other places. Read all the other guides.

How to conditionally update a table in Okta Workflows?

This guide will teach you how to update a table based on a condition. If the condition is true, you will update the record. If the condition is false, you will add a new record.

Conditionally updating a table

The table has two columns: Product and Access counter:

Workflows table image
Workflows table

The flow below will search the table for a product. If a product is found, the Access counter is updated. A new record is added to the table if a product is not found.

Update or create a record in a table flow image
Update or create a record in a table flow

The above flow has the following steps:

  1. The Helper Flow card provides input to the flow. You can enter a product in the table or a new product.
  2. The Tables – Search Rows card searches the table for the entered product. It returns the Row ID field.
  3. 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 was 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’s 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).

The Branching – If/Else card condition editing:

Editing Branching - If/Else card condition image
Editing Branching – If/Else card condition

Clicking on the ✏️ icon (arrow pointing) will open the following view to edit the condition:

Condition editing image
Condition editing

Running the flow with input Bread results in a record update:

Testing the flow image
Testing the flow

After the run, the Access counter for Bread is updated:

Table after update image
Table after update

Running the flow with input Cheese results in a new record:

Testing the flow image
Testing the flow

After the run, the table has a new product record:

Table after adding new product image
Table after adding new product

Workflows resources

🍫 Get help from Workflows specialists during weekly community office hours.

πŸ“Ί Learn from Workflows videos.

πŸ›Ÿ Get help from support: discuss a Workflows topic or ask a question.

πŸ™‹πŸ»β€β™€οΈ Get help from the community: join the #okta-workflows channelon MacAdmins Slack.

Leave a comment