References a one-to-many relationship defined on a record type and allows for additional filtering, sorting, and limiting of the related record set.
See also:
Keyword | Type | Description |
---|---|---|
|
Record Type Relationship |
A reference to a one-to-many record type relationship, configured using the |
|
Number (Integer) |
Number of related records to return. If you're using this function in a!queryRecordType() or in a records-powered component, the maximum number is 10. If you're using this function in a!queryRecordByIdentifier(), the maximum number is 100. |
|
List of SortInfo |
Array of Sort Info configurations created with |
|
Any Type |
A single logical expression or a list of query filters, which are applied together with an |
List of RelatedRecordData
This function is only supported on record types that have data sync enabled and have a one-to-many relationship with another record type.
You cannot use this function when performing an aggregation in a!queryRecordType()
or in a records-powered chart.
Use this function to filter, sort, or limit the related record data returned from a one-to-many relationship referenced in a!queryRecordType()
, a!queryRecordByIdentifier()
, or in an a!recordData()
function used in a read-only grid.
See Examples for sample use cases.
The maximum number of related records returned for each base record varies depending on the calling function:
Function | Maximum number of related records |
---|---|
a!queryRecordType() |
10 |
a!recordData() |
10 |
a!queryRecordByIdentifier() |
100 |
In any case, if you don't specify a limit, the maximum is applied by default.
For example, when querying multiple customers and their related support cases using a!queryRecordType()
, the query will return a max of 10 related support cases for each customer if no limit is applied.
If you use a!queryRecordByIdentifier()
to query a single customer and their related support cases, the maximum of 100 related records is returned by default.
When applying a filter or sort to a!relatedRecordData()
, your record field or related record field reference must start from the related record type specified in the relationship parameter.
For example, the Department record type has a one-to-many relationship with the Employee record type, and you only want to see the employees in each department that have a status of "Active".
To return this data, you would do something like:
1
2
3
4
5
6
7
8
9
10
11
12
13
relatedRecordData: {
/*Only return related Employees that have a status of active*/
a!relatedRecordData(
! relationship: recordType!Department.relationships.employee,
filters: {
a!queryFilter(
! field: recordType!Employee.fields.status,
operator: "=",
value: "Active"
)
}
)
}
The following examples demonstrate how to use a!relatedRecordData()
in the a!queryRecordType() function. We'll use the Customer record type, which has a one-to-many relatonship with the Case record type, to return information about customers and their related support cases.
See the a!recordData() function for an example using a!relatedRecordData()
in a read-only grid.
Record type object references are specific to each environment. If you copy and paste these examples into your interface, they will not evaluate. Use them as a references only.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
a!queryRecordType(
recordType: recordType!Customer,
fields: {
/*Fields from the Customer record type*/
recordType!Customer.fields.name,
recordType!Customer.fields.phoneNumber,
/*Related fields from the Case record type*/
recordType!Customer.relationships.cases.fields.title
},
relatedRecordData: {
/*Only return the latest support case for a customer*/
a!relatedRecordData(
relationship: recordType!Customer.relationships.cases,
sort: {
a!sortInfo(
field: recordType!Case.fields.createdOn,
ascending: false
)
},
limit: 1
)
},
pagingInfo: a!pagingInfo(
startindex: 1,
batchSize: 500
)
)
Returns
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
a!queryRecordType(
recordType: recordType!Customer,
fields: {
/*Fields from the Customer record type*/
recordType!Customer.fields.name,
recordType!Customer.fields.phoneNumber,
/*Related fields from the Case record type*/
recordType!Customer.relationships.cases.fields.title
},
relatedRecordData: {
/*Only return related cases that have a priority of critical*/
a!relatedRecordData(
relationship: recordType!Customer.relationships.cases,
filters: {
a!queryFilter(
field: recordType!Case.relationships.priority.fields.label,
operator: "=",
value: "Critical"
)
}
)
},
pagingInfo: a!pagingInfo(
startindex: 1,
batchSize: 500
)
)
Returns
Tip: Since there is no limit specified in a!relatedRecordData
, the number of related records to return will default to 10.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
a!queryRecordType(
recordType: recordType!Customer,
fields: {
/*Fields from the Customer record type*/
recordType!Customer.fields.name,
recordType!Customer.fields.customerSince,
/*Related fields from the Case record type*/
recordType!Customer.relationships.cases.fields.title,
recordType!Customer.relationships.cases.fields.status,
/*Related fields from the Comments record type*/
recordType!Customer.relationships.cases.relationships.comments.fields.commentText
},
relatedRecordData: {
/*Only return the latest case with a priority of critical*/
a!relatedRecordData(
relationship: recordType!Customer.relationships.cases,
filters: {
a!queryFilter(
field: recordType!Case.relationships.priority.fields.label,
operator: "=",
value: "Critical"
)
},
sort: {
a!sortInfo(
field: recordType!Case.fields.createdOn,
ascending: false
)
},
limit: 1
),
/*Only return the latest comment associated with each critical case*/
a!relatedRecordData(
relationship: recordType!Customer.relationships.cases.relationships.comments,
sort: {
a!sortInfo(
field: recordType!Comments.fields.createdOn,
ascending: false
)
},
limit: 1
)
},
pagingInfo: a!pagingInfo(
startindex: 1,
batchSize: 500
)
)
Returns
Feature | Compatibility | Note |
---|---|---|
Portals | Compatible | |
Offline Mobile | Compatible | |
Sync-Time Custom Record Fields | Incompatible | |
Real-Time Custom Record Fields | Incompatible | Custom record fields that evaluate in real time must be configured using one or more Custom Field functions. |
Process Reports | Incompatible | Cannot be used to configure a process report. |
Process Events | Incompatible | Cannot be used to configure a process event node, such as a start event or timer event. |
a!relatedRecordData() Function