Relationships and one-way links between records
team
(people), associated_deals
(deals) and associated_workspaces
(workspaces)company
(company), associated_deals
(deals) and associated_users
(users)associated_people
(people) and associated_company
(company)person
(person) and workspace
(workspace)users
(users) and company
(company)team
property, will also update the company
property on that person.
Currently, you will be able to see relationship attributes alongside other non-relationship record reference attributes in the API. The attribute type is still marked as record-reference
, but there is an additional property, relationship
, that you can use to distinguish these.
If the attribute is also a relationship attribute, the relationship
property will be an object containing an id
property. In the example below, our company’s team
attribute has a relationship with the person’s company
attribute:
relationship
property will be set to null
.
In the web application, when setting up a relationship, the user specifies whether the relationship is many-to-many, many-to-one, one-to-many or one-to-one. It is possible to discern this relationship by looking at the is_multiselect
property on each attribute: if true
, this attribute is a “many”, if false
it is a “one”.
Unfortunately, at present it is not possible to create relationship attributes using the API; they can only be created in the web application and then used in the API.
team
attribute. This is accomplished with the configuration property allowed_object_ids
which is an array of object IDs (slugs are supported when writing this property):
allowed_object_ids
, like so:
target_object
(the api_slug
representing what kind of object it is) and target_record_id
(the ID of the Record).
domains
attribute.email_addresses
attribute.user_id
attribute.workspace_id
attribute.user_id
text values.workspace_id
text values.target_object
and target_record_id
using exact equality matches.
$in
operator.
paths
is an array containing tuples of (object type, attribute slug or ID)
, while constraints
are applied to the attribute identified by the final path element.
For example, we could construct a filter like “find me Companies which have an employee named John”:
team
attribute on a Company, which is a multi-select record reference to the person record. We then look across at those related people
, and their name
attribute values. Finally, since name
is a (personal) name attribute, we can query against the first_name
property.
Paths can be more complex, and even somewhat recursive. For example, if you had a manager
attribute on the Person object, and it pointed to another Person, you could find people by who their manager’s manager’s manager was: