Forum Discussion

EvanMartinez's avatar
EvanMartinez
Qrew Elite
3 years ago

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: 

    1. Create a new pipeline and give it a descriptive name 
    2. Open the Quick Base channel, then open the Records category 
    3. Drag the Record Updated trigger onto the canvas 
    4. In Account, select your user token or enter a new one (click here to learn how). 
    5. For this example, select the Projects table, which is the parent record in the example 
    6. Set Trigger on Any Field to No 
    7. 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 
    8. 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 
    9. 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: 

    1. Drag the Search Records step onto the canvas as Step B 
    2. In Account, select your User Token 
    3. Select the Tasks table 
    4. 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 
    5. Click Add conditions 
    6. In the Query Section, select Related Project  
    7. Select Is 
    8. 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: 

    1. Drag Update Record action into the Do branch as Step C. The record from the search step is selected automatically.  
    2. Click Add Fields, and select Status 
    3. 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. 

    Resources

    No RepliesBe the first to reply