Update Records

Definition

The Update Records action allows you to efficiently modify multiple records within a Zenphi Table that meet specific criteria. Instead of changing records one by one, you can define a condition to target a group of records and then apply the same changes to all of them simultaneously.

  • Key capabilities:
    • Target specific records for updates using a powerful and flexible condition builder.
    • Update one or more fields across all matched records in a single operation.
    • Use both static (fixed) and dynamic (from previous steps) data to populate the new values.

This action is fundamental for automating bulk data maintenance, such as updating the status of multiple tasks, archiving old entries, or synchronizing information across your workflows.


Inputs

  1. Table

    • Purpose: This field is for selecting the specific Zenphi Table where you want to update records.
    • Practical Guidance: You will typically choose from a dropdown menu that lists all the Zenphi Tables you have access to. This is usually a static value selected when you design your flow, as the target table rarely changes during a single workflow execution.
    • Use Case Context: You would use the 'Table' field to select your "Project Tasks" table before updating the status of several tasks at once.
  2. Condition

    • Purpose: This field allows you to build a logical rule to identify exactly which records in the table should be updated. Records that do not match this condition will be ignored.
    • Practical Guidance: You define a condition by selecting a column from your table, choosing a comparison operator (like equal to, contains, is not null), and then providing a value to check against. This value can be a static value (e.g., typing the text "In Progress") or a dynamic value from the token picker (e.g., using a status from a previous approval step). You can also add multiple conditions and link them with 'AND' or 'OR' to create more complex filters.
    • Use Case Context: You would use the 'Condition' field to find all records where the 'Status' column is equal to "Pending Approval".
  3. Select fields to update records

    • Purpose: This is where you specify which columns of the matched records you want to change and what the new values should be.
    • Practical Guidance: You will choose one or more fields (columns) and provide the new content for each. This is particularly effective for bulk changes using a static value, such as setting the 'Is Archived' field to "True" for all matched records. You can also use a dynamic value from the token picker to insert information from earlier in the flow, like setting an 'Update Date' field to the current execution time.
    • Use Case Context: You would use this section to change the 'Assigned To' field to a new user's ID for all tasks that met your condition.

Outputs

  1. Updated Records
    • Data Description: This output provides a number that represents the total count of records that were successfully modified by the action.
    • Workflow Utility: This count is extremely useful for logging, auditing, and conditional logic. You can pass the Updated Records token to a subsequent 'Send Email' action to confirm that "X records were successfully archived." Alternatively, you can use it in a conditional branch: for example, if the count is greater than zero, send a notification; otherwise, log that no records matched the criteria.

Example Use Cases

  1. Bulk Update Task Statuses Simultaneously change the status of multiple project tasks from "Pending" to "In Progress" when a project phase begins.
  2. Archive Old Records Automatically mark all records older than a specific date as "Archived" to maintain a clean and current data table.
  3. Reassign Work Items Transfer ownership of all tasks assigned to one user to another when team roles change or an employee leaves.
  4. Standardize Data Entries Clean up data by finding all records with a specific non-standard value (e.g., "USA") and updating them to a standardized format (e.g., "United States").

Example

Scenario: A project manager maintains a "Project Tasks" table in zenphi. At the end of each month, they need to archive all tasks that were marked as "Completed" during that month to keep the active task view clean. Manually updating each record is time-consuming and prone to error.

Steps to Implement:

  1. Create a scheduled flow that triggers on the first day of every month. This will automate the archival process.
  2. Configure the Update Records action with the following settings:
    • Table: Select the "Project Tasks" Zenphi Table from the dropdown list.
    • Condition: Build a rule to find the correct records. Set up two conditions linked by an 'AND' operator:
      • Condition 1: Status (column) is equal to "Completed" (static value).
      • Condition 2: Completion Date (column) is before the first day of the current month (dynamic value).
    • Select fields to update records: Specify the change to be made to all matched records.
      • Field to Update: Is Archived (column).
      • New Value: True (static value).
  3. Add a "Send an email" action after the "Update Records" action. Use the Updated Records output token in the email body to send a confirmation message, such as: "Monthly archival complete. [Updated Records] tasks were successfully archived."

Outcome: The workflow automatically runs each month, identifies all completed tasks from the previous month, and flags them as archived. This eliminates manual work for the project manager, ensures data hygiene is consistently maintained, and provides a clear audit trail through the confirmation email.


Best Practices

  1. Test Your Conditions First Before running the flow on your primary data, test your condition logic in a development table or with a "Read Records" action to ensure it targets only the intended records. An incorrect condition could lead to widespread data errors.
  2. Ideal for Static Bulk Changes This action is most efficient when you need to apply the same fixed value to multiple records, such as setting a status to "Archived," changing a priority level, or assigning all matched items to a specific user.
  3. Use Dynamic Tokens for Timestamps When updating records, populate a "Last Modified Date" column with a dynamic token for the flow's execution time. This creates a valuable audit trail, showing exactly when the bulk update occurred.
  4. Leverage the Output Count for Logging Always use the Updated Records output count. Pass this number to a logging system or a notification step to confirm how many records were affected, which is crucial for verifying the flow ran as expected.