A workflow rule can be used to:

  1. Change one or more data values in one or more tables.
  2. Delete one or more records in one or more tables.

Changing a Data Value
Suppose your app has a Projects table and an Employees table. Each row in the Projects table records a single project, and each row in the Employees table records a single employee. The Projects table references the Employees table, which means that each project must be assigned to one employee. You want to design the app such that every time a new project is added, the status of the corresponding employee will be automatically updated to "Assigned". To do this:

1. Create an action called "Update Employee Status". The action type is "Set the value of a column", and the action's target table is the Employees table. Configure the target column and the update expression of the action to set the employee's status to "Assigned".

2. Create an action called "Get Employees to Update". The action type is "Execute an action on a set of rows", and the action's target table is the Projects table. Set the "referenced table" of the action to the Employees project, and the "referenced action" to the "Update Employee Status". In the "referenced rows" expression of the expression, provide an app expression that returns a list of row keys from the Employees table. The row keys will be used by AppSheet to identify the employees to be updated. For example, to select the employee that has been assigned to the current project, the following expression can be used:

SELECT(Employees[Employee ID], [Employee ID] = [_THISROW].[Employee ID])

3. Create a workflow rule called "On Adding New Project". Select "ADDS_ONLY" as the workflow's update event, and set the workflow's target table to the Projects table. Select "Data Change" as the workflow's action type, and set the "Get Employees to Update" action to be the workflow's action name.


Each time a new project is added to the Projects table, the "On Adding New Project" workflow will be triggered. This workflow will invoke the action "Get Employees to Update", which will select the employees to be updated from the Employees table. Once the employees have been selected, the action "Update Employee Status" will be applied to each selected employee, which will change the employee's status to "Assigned".

Changing Multiple Data Values

You can update more than one column in the Employees table. Suppose that apart from the employee's status, you also want the app to automatically update the employee's deadline based on the deadline of the recently added project. To do this, modify the implementation above as follows:

1/ Create an action called "Update Employee Deadline". The action type is "Set the value of a column", and the action's target table is the Employees table. Configure the target column and the update expression of the action to set the employee's deadline.

2/ Follow the same instructions above to create the "Update Employee Status" action.

3/ Create an action called "Update Employee". The action type is "Execute a sequence of actions", and the action's target table is the Employees table. Add both the "Update Employee Deadline" and "Update Employee Status" actions to the list of actions to be executed.

4/ Follow the same instructions above to create the "Get Employees to Update" action. However, this time set the referenced action to "Update Employee" instead of "Update Employee Status".

5/ Follow the same instructions above to create the "On Adding New Project" workflow.


Each time a new project is added to the Projects table, the "On Adding New Project" workflow will be triggered. This workflow will invoke the action "Get Employees to Update", which will select the employees to be updated from the Employees table. Once the employees have been selected, the action "Update Employee" will be applied to each selected employee. When this happens, the list of actions in the "Update Employee" action will be executed. Note that any number of actions can be added to the "Update Employee" action.

Did this answer your question?