I’m building a CRM in Tinderbox, still. And with Claude’s help. I have two containers: Connections Raw (connection notes, each with a $LinkedinURL attribute) and Messages Raw (message notes, each with a $MessageKey attribute containing a LinkedIn URL, and a $ProspectTrigger attribute that may equal “Prospect”).
The goal of Agent: Flag Prospects is to find connection notes that have at least one matching message note where $MessageKey == $LinkedinURL and $ProspectTrigger == “Prospect”, then set $IsProspect = true on the connection note.
The query I want to express:
For each note descended from Connections Raw, find any note in the document where $MessageKey equals this connection note’s $LinkedinURL and $ProspectTrigger equals “Prospect”. If such a note exists, include this connection note in the agent’s results.
What I’ve tried:
- Original query:
descendedFrom("Connections Raw")
& $LinkedinURL != ""
& !$IsProspect
& find($MessageKey == $LinkedinURL & $ProspectTrigger == "Prospect" & !$IsAlias) != ""
Result: flagged all 12 connection notes, including 6 that have no matching message notes. Diagnosis: inside find(), $LinkedinURL resolves to the note being tested by find() (a message note), not the calling connection note. Since message notes have no $LinkedinURL, the comparison $MessageKey == $LinkedinURL was comparing $MessageKey to an empty string — and some message notes have an empty $MessageKey, producing false matches.
- Query using
thatdesignator, per aTbRef:
descendedFrom("Connections Raw")
& $LinkedinURL != ""
& !$IsProspect
& find($MessageKey == $LinkedinURL(that) & $ProspectTrigger == "Prospect" & !$IsAlias) != ""
Result: flags no notes at all. aTbRef says that is evaluated in stamps — it may not be valid in agent queries.
Test data:
-
12 connection notes in Connections Raw, each with a unique $LinkedinURL
-
6 message notes with $MessageKey matching the first 6 connection note URLs, $ProspectTrigger = “Prospect”
-
6 message notes with $MessageKey matching the same first 6 URLs, no $ProspectTrigger
-
6 message notes with $MessageKey set to URLs that match none of the connection notes, $ProspectTrigger = “Prospect”
Expected result: exactly the first 6 connection notes flagged.
The question: What is the correct way to reference the calling note’s $LinkedinURL value inside a find() expression within an agent query?
I’ve uploaded the TBX file containing dummy data.
TheodoreCRM2026_clean4.tbx (137.9 KB)