Skip to main content
Question

Pipeline help

  • Jul 14, 2025 6:47 PM UTC
  • 2 replies
  • 83 views

Forum|alt.badge.img

I have a parent table called principal investigators (PI) that has a child table called "applications". This is for external users to apply to a grant we are hosting, all the information will come through a form in the applications table. However, I want to pull information from the applications table into the PI table for future querying. 

 

Very simply, users will put in their name, email address, and departmental affiliations which I want to then create a record in the PI table if it does not exist. If it does exist, I want to update the applications table with the related PI record ID. I cannot get this to trigger properly and I have tried many times. It fails at the IF/ELSE statement. Here is my YAML file below if it helps (I removed identifying information): 

# Add PI to table
#

# Account slugs:
# - quickbase[DB]: Realm Default Account <None>
---
- META:
name: Add PI to table
enabled: false
- TRIGGER quickbase[DB] record on_create -> a:
inputs-meta:
allow_triggers: Any
export_fields: '"Applicant Name, Applicant Email, Departmental Affiliations,
Related Investigator" <6, 9, 81, 234>'
table: '"Awards Portal: Applications" <##>'
- QUERY quickbase[DB] record search -> b:
inputs-meta:
export_fields: '"Email Address, Full Name" <7, 6>'
table: '" Awards Portal: Principal Investigators" <##>'
name: Search for records in PI table
note: Search for records in PI table that match the applicant email
- b<>LOOP:
- DO:
- IF:
- AND:
- a<>applicant_email equals {{b.email_address}}
- THEN:
- a<>ACTION quickbase record update -> c:
inputs:
related_investigator: '{{b.id}}'
name: Update the record
note: This step updates a record in the table
- ELSE:
- ACTION quickbase[DB] record create -> d:
inputs-meta:
export_fields: '"Affiliations, Email Address, Full Name" <8, 7, 6>'
table: '"Awards Portal: Principal Investigators" <DB>'
inputs:
affiliations: '{{a.departmental_affiliations}}'
email_address: '{{a.applicant_email}}'
full_name: '{{a.applicant_name}}'
name: Create the record
note: This step creates a record in the table
- a<>ACTION quickbase record update -> e:
inputs:
related_investigator: '{{d.id}}'
name: Update the record
note: This step updates a record in the table
- metadata:
name: If a condition is met, do something
note: Check if condition is true
- metadata:
name: Iterate through the records
note: Iterate through the records found in the previous step
... 

2 replies

Forum|alt.badge.img

Just trying to understand the problem space. Are you saying that the first applicant automatically becomes the primary investigator? Why not have the form on the PI table? Apologies, not necessarily questioning your approach, just trying to understand. What will happen to subsequent applicants?


Top Step
Forum|alt.badge.img+9
  • Registered
  • Oct 27, 2026 4:04 PM UTC

The IF/ELSE inside the loop is the problem. A loop runs once per record the search returns. If the search is filtered by email, a new applicant returns zero PIs, so the loop runs zero times and the ELSE that should create the PI never fires. If the search isn't filtered, the ELSE fires for every other PI in the table and you get duplicates.

It's easier to make sure the PI exists before you search. Set the Email Address field on the PI table to Unique, then:

Prepare Bulk Record Upsert on the PI table, with Email Address as the merge field.

Add a Bulk Upsert Row with the applicant's name, email and departments.

Commit Upsert. If the email exists, that PI gets updated, otherwise a new one is created.

Then Search Records on PI with a filter of Email Address equals the applicant email, and inside that loop update the Application's Related Investigator with the PI's Record ID#. Use the exact same email expression in the upsert and the search, or the search can come back empty.

By that point the PI always exists, so the filtered search finds exactly one and the loop runs exactly once. If you don't want an existing PI's name or departments overwritten, only map the email in the upsert row.

Want more detail? I wrote a full walkthrough here: https://www.topstep.tech/blog/quickbase-pipelines-create-or-link-parent-record-upsert