Updating a Child Record when the Parent Record is Modified with Pipelines
Updating a Child Record when the Parent Record is Modified with Pipelines
Introduction
Have you been looking for a way to update manual entry fields on your child records when important changes happen on your parent records? For example, imagine a company tracks hundreds of projects, each project having hundreds of tasks. They want to track each task individually until a project is completed, then they need all the tasks to be set to complete. Doing this manually would be time-consuming and tedious work. Instead using Pipelines they can make sure that their completed Project automatically triggers a Pipeline set up to mark all their all their outstanding Tasks as completed to get rid of unnecessary clean up.
Overview
Assume the following table structure:
Projects -> Tasks
Scenario: If a Project’s status is set to completed, all status for each related Task status should also be set to completed.
Overview of example pipeline
- Step A: Trigger the pipeline when a record on the Project table is modified and the project’s status is set to complete
- Step B: Search the Tasks table for all child records related to the modified Project from Step A
- Then, for reach Child task:
- Step C: Update the task.
Guided Instructions
Pipeline Step A: Trigger when Project is Updated
Step A triggers the pipeline whenever a Project is updated AND a specific condition is met
- Condition: Status is equal to Completed
Setup:
- Create a new pipeline and give it a descriptive name
- Open the Quick Base channel, then open the Records category
- Drag the Record Updated trigger onto the canvas
- In Account, select your user token or enter a new one (click here to learn how).
- For this example, select the Projects table, which is the parent record in the example
- Set Trigger on Any Field to No
- In Trigger on Any of These Fields, select Status
Note: Steps 6 & 7 ensures this Pipeline only triggers when necessary. These steps should be taken whenever possible in Pipeline creation for step-run efficiency - In Specify Fields for Use in Subsequent Steps, select Status. This allows the Status field to be used in the query, which you’ll define next, and allows the field to be used later in the pipeline
Note: If you are using a custom key field, you’ll need to define that here - Click Add Conditions to define a query. In the Query section define the Status the project must have for this pipeline to trigger. For this use-case, only trigger the pipeline when the Project is Completed
Note: Not defining a query would cause the pipeline to trigger whenever the status field changed, regardless of what it was set to.
Step B: Search for related tasks
Step B identifies the child Tasks that are related to the parent Project defined in Step A. To do this, search the Tasks table for the related Tasks.
Setup:
- Drag the Search Records step onto the canvas as Step B
- In Account, select your User Token
- Select the Tasks table
- Under Fields, select Related Project and Status
Note: This allows you to use the Related Project field in your query and to leverage the Status field’s value later in the pipeline - Click Add conditions
- In the Query Section, select Related Project
- Select Is
- Drag the Record ID field from Step A in the box so the condition reads: Related Project is {{a.id}}
Note: This is a critical step in the configuration of the pipeline. This ensures only the children Tasks of the related parent Project are being updated in the next step. If you’re using a custom key field, be sure to select the child table’s reference field in the query, and drag the custom key field into the query
Step C: Update the related Tasks
Step C updates each child Task record found in Step B to Completed.
Setup:
- Drag Update Record action into the Do branch as Step C. The record from the search step is selected automatically.
- Click Add Fields, and select Status
- Set the value of the Status field to Completed
With this set up you can make sure Tasks aren't left unfinished triggering notifications and reminders or leaving confusion about finished projects for your employees.