Introduction
Using the structural metadata for tree navigation one can fetch the (direct) children of a record or get the grandparents of a record.
Reference Codes & Has Children
The metadata field
Structural.ReferenceCodes
is an ordered multi-item field (see Complex Fields) containing the record IDs from the parents, starting from the oldest / first.
{ "Structural": { "ReferenceCodes": { "Series": ["3e3b17c058b14ed79095c7fc9c4af88848bd7afbc5294c19a214625a5a5d3d7d"], "Dossier": ["6b83485cfe1f48729ab493f912b2c7cc6336afdc597843e7bcaf664abd209043"], "Document":["120b5fe7f7a346bca277e13988ed96224f40330432584955b6e33b524321dff5"] } } }
Once a record obtains its first child the field
HasChildren
will be set to true for the parent. Even if the child is later on permanently deleted, the fieldHasChildren
will betrue
forever on the parent
Navigation
From child to parent
The metadata field
ParentRecordId
provides theRecordId
of its parent → Metadata Fields
From child to grandparents
The field ReferenceCodes
contains the full line of ancestors. The sub-fields are in the exact order of the grandparents from top to bottom with as key the RecordType
of the (grand)parent as value the RecordId
of the (grand)parent.
From parent to direct children
Make a search request on the field
ParentRecordId
Form
+Structural.ParentRecordId:<my RecordId>
Example
+Structural.ParentRecordId:3e3b17...
From parent to all (grand)children
Make a search request using the matching sub-field of
ReferenceCodes
Form
+Structural.ReferenceCodes.<my RecordType>:<my RecordId>
Example all (grand)children of particular Series:
+Structural.ReferenceCodes.Series:3e3b17...