Change workflows on data updates

 

Triggering a workflow rule on Add, Update, or Delete

You can trigger a change workflow rule when data is added, updated, or deleted. For example,

  • You can invoke an action when a new data row is added.
  • You can invoke an action when an existing data row is updated.
  • You can invoke an action when a existing data row is deleted.

The AppSheet workflow rules are triggered on the AppSheet server when a user does an add, update, or delete through the AppSheet client and then syncs these changes back to the server. When the client syncs the changes to the server, the server first makes the appropriate changes to the spreadsheet and then saves the updated spreadsheet. This ensures that any formulas in the spreadsheet are re-computed before the workflow rule is invoked. This ensures that the workflow action has access to the latest data values. The AppSheet server then checks whether any workflow rules should be triggered.

A workflow rule is triggered when the table you specify in the workflow rule is changed.

You can further restrict when a workflow rule is triggered by specifying the type of update that triggers the workflow rule. For example:

  • Trigger the workflow rule when a new row is added to the table.
  • Trigger the workflow rule when a row is updated in the table.
  • Trigger the workflow rule when a row is deleted from the table.
  • Trigger the workflow rule when a row is added to the table or deleted from the table.
  • Trigger the workflow rule when a row is added, updated, or deleted in the table.

You can still further restrict when a workflow rule is triggered by specifying a Condition in the workflow rule. For example,

  • Trigger the workflow rule when a new row is added to the Inspections table, and the value in the InspectionPassed field is false.
  • Trigger the workflow rule when a row is updated in the Orders table, and the value in the OrderAmount field is over $500 and the value in the DeliveryDate field is within 10 days of the current date.

Changes you make directly to the spreadsheet do not go through the AppSheet server, so they do not trigger the AppSheet workflow rules. For example, if you update a Google Sheet directly, Google Sheets does not notify the AppSheet server about the change. Since the AppSheet server is unaware of this change, it does not trigger any AppSheet workflow rules.

Triggering a workflow rule when specific columns are updated

You can trigger a workflow rule when specific columns are updated.

Method 1:

  1. Add a DateTime column to your worksheet. This must be a worksheet column; not a Virtual column. You might call this column "RowUpdated". Assign this column the AppFormula of Now(). This column is automatically updated whenever the row is updated.
  2. Add a ChangeTimestamp column to your worksheet. This must be a worksheet column; not a Virtual column. You might call this column "ColumnUpdated". In the "ChangeColumns" attribute for this column, list the name of each column you wish to monitor for changes. This column is automatically updated whenever any of the columns listed in "ChangeColumns" is updated.
  3. Add a workflow rule. Set "Table" to the table name you are monitoring for changes. In "ChangeEvent" select "UPDATES_ONLY".
  4. If you wish to trigger the workflow rule each time the column changes, enter the following expression in the "And if this condition is true" property:
    AND(NOT(ISBLANK([ColumnUpdated])),[ColumnUpdated] >= [RowUpdated])
  5. Alternatively, if you wish to trigger the workflow rule when the column is assigned a specific value, enter an expression like the following in the "And if this condition is true" property:
    AND([Status]="MyDesiredStatus", [ColumnUpdated] >= [RowUpdated])

 Method 2:

  1. Add a ChangeCounter column to your worksheet. This must be a worksheet column; not a Virtual column. You might call this column "ColumnUpdated". In the "ChangeColumns" attribute for this column, list the name of each column you wish to monitor for changes (optionally, you can also specify "ChangeValues" to watch for). This column is automatically updated whenever any of the columns listed in "ChangeColumns" is updated (and only when matching any of the ChangeValues, if provided).
  2. Set the "UpdateMode" of the ChangeCounter to "Reset". This will cause the counter to reset to its initial value at the start of each update (by default, 0). 
  3. Add a workflow rule. Set "Table" to the table name you are monitoring for changes. In "ChangeEvent" select "UPDATES_ONLY".
  4. Enter the following expression in the "And if this condition is true" property: 
    [ColumnUpdated] > 0

 

Click here to see an example of how workflow emails work.

Have more questions? Submit a request

0 Comments

Article is closed for comments.