a!recordData( recordType, filters, relatedRecordData )
This function references a set of records from a record type and allows additional filtering in a read-only grid or chart that uses a record type as the source. When referencing one-to-many relationships in grid columns, you can filter, sort, and limit that related record set using the relatedRecordData parameter and the a!relatedRecordData()
function.
See also:
Keyword | Type | Description |
---|---|---|
|
RecordType |
A reference to a record type, configured using the |
|
Any Type |
A single logical expression or a list of query filters, which are applied together with an |
|
List of RelatedRecordData |
When selecting one-to-many related record data, use |
RecordData
a!recordData()
function is only supported in the data parameter of the read-only grid and charts.recordType!Employee.fields.department
or recordType!Employee.relationships.cases.fields.status
.a!recordData()
is used in a read-only grid, and references a record type that has a one-to-many relationship.To change the default limit and sort behavior on your one-to-many related records, you can configure the a!relatedRecordData()
function to apply a new limit and sort, as well as filter the related record set.
For example, let's say you have a read-only grid that displays customer information, and you add the related record field orderNumber
as a new column in the grid. By default, each customer will have a maximum of 10 orders listed in their row. The orders for each customer will be sorted in ascending order by the primary key field in the Order record type.
To only display the latest order for each customer, you can configure the a!relatedRecordData()
function in the relatedRecordData parameter so you can limit the related orders to 1
and sort by orderDate
in descending order.
The following examples reference an Employee record type, which has a one-to-many relationship with the Case record type.
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
a!gridField(
label: "Employees",
data:
a!recordData(
recordType: recordType!Employee,
filters: a!queryFilter(
field: recordType!Employee.fields.title,
/* This filter removes all records where "Manager" is found in the "Title" column. */
operator: "<>",
value: "Manager"
)
),
columns: {
a!gridColumn(
label: "Name",
sortField: recordType!Employee.fields.lastname,
value: a!linkField(
links: {
a!recordLink(
label: fv!row[recordType!Employee.fields.firstname] & " " & fv!row[recordType!Employee.fields.lastname],
recordType: recordType!Employee,
identifier: fv!identifier
)
}
)
),
a!gridColumn(
label: "Title",
sortField: recordType!Employee.fields.title,
value: fv!row[recordType!Employee.fields.title]
),
a!gridColumn(
label: "Department",
sortField: recordType!Employee.fields.department,
value: fv!row[recordType!Employee.fields.department]
),
a!gridColumn(
label: "Phone Number",
sortField: recordType!Employee.fields.phonenumber,
value: fv!row[recordType!Employee.fields.phonenumber]
)
},
)
This would return something like:
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
a!gridField(
label: "Employees",
data: a!recordData(
recordType: recordType!Employee,
/* This filter removes all records where "Manager" is found in the "Title" column. */
filters: a!queryFilter(
field: recordType!Employee.fields.title,
operator: "<>",
value: "Manager"
),
/* This function limits the number of returned support cases to 1
and returns that latest open support case based on its creation
date and status. */
relatedRecordData:
a!relatedRecordData(
relationship: recordType!Employee.relationships.cases,
limit: 1,
sort:
a!sortInfo(
field: recordType!Case.fields.createdOn,
ascending: false
),
filters:
a!queryFilter(
field: recordType!Case.fields.status,
operator: "=",
value: "Open"
)
)
),
columns: {
a!gridColumn(
label: "ID",
sortField: recordType!Employee.fields.id,
value: fv!row[recordType!Employee.fields.id],
align: "END",
width: "ICON"
),
a!gridColumn(
label: "First Name",
sortField: recordType!Employee.fields.firstName,
value: fv!row[recordType!Employee.fields.firstName]
),
a!gridColumn(
label: "lastName",
sortField: recordType!Employee.fields.lastName,
value: fv!row[recordType!Employee.fields.lastName]
),
a!gridColumn(
label: "Phone Number",
sortField: recordType!Employee.fields.phoneNumber,
value: fv!row[recordType!Employee.fields.phoneNumber]
),
a!gridColumn(
label: "Title",
sortField: recordType!Employee.fields.title,
value: fv!row[recordType!Employee.fields.title]
),
a!gridColumn(
label: "Latest Case",
sortField: recordType!Employee.relationships.cases.fields.caseTitle,
value: fv!row[recordType!Employee.relationships.cases.fields.caseTitle]
)
}
)
This would return something like:
Feature | Compatibility | Note |
---|---|---|
Portals | Compatible | |
Offline Mobile | Partially compatible | Can be used with offline mobile if it is loaded at the top of the form. |
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!recordData() Function