$join
The $join function allows you to join two or more search queries together.
A $join function has 4 parts:
The char type ID of the object.
The field to extract from the object.
The field to transpose the extracted field into.
The object (either record or relationship)
The $join query can be added to any other Multi-query functions (such as $and
or $or)
where you can now use the transposed field in that query.
In the following example, in the innermost join (line 12), the 0
indicates the object is a relationship. The relrecid
is the field you want to extract from the object, and the parentrecordid
is the field you want that previous field to represent in any parent query. So the logic would be, get the following relationship’s (0) relrecid as the parentrecordid.
Similarly with the outermost join (line 3), get the following relationship’s (0
) childrecordid
as the recordid
. Since all of those relationship’s child records are catalog items (denoted by the line {"$eq": ["childchartypeid", 1]}
), and you are doing a catalog-item search, you will be returned a list of catalog item records.
Example: Get catalog items on a right (record ID = 111) on a deal (record ID = 1234)
Last updated