Free cookie consent management tool by TermsFeed

a!queryRecordByIdentifier_25r2() Function

On This Page

This page contains information related to an old version of the a!queryRecordByIdentifier() Function.

To take advantage of the latest features and improvements, we always recommend you use the latest version whenever possible. For what's changed, see New version details.

Function

a!queryRecordByIdentifier_25r2( recordType, identifier, fields, relatedRecordData )

Executes a query on a given record identifier and returns the record data.

a!queryRecordByIdentifier_25r2() and a!queryRecordType() are designed to be used in specific situations, and one is often a better choice than the other. Read more about choosing the right query function.

See also:

Parameters

Keyword Type Description

recordType

RecordType

A reference to a record type. You must reference the record type directly from the recordType! domain. For example, recordType!Case.

identifier

Any Type

The identifier of the record to query. This is typically the primary key field.

fields

Any Type

Fields to be retrieved for the query. Use a list of record field or related record field references defined with the recordType! domain. When this parameter is null, all record fields from the specified record type are returned.

relatedRecordData

List of RelatedRecordData

When selecting one-to-many related record data, use a!relatedRecordData() to filter, sort, and limit the related record sets.

Returns

Record Type

Usage considerations

a!queryRecordByIdentifier() versus a!queryRecordType()

Depending on the amount of data you need and whether you want to aggregate that data, you can use:

  • a!queryRecordType() function to select or aggregate data from a record type. This function is great for building interfaces that show multiple records to users.

  • a!queryRecordByIdentifier() function to return data for a specific record and any of its related record data. This function is a good choice when building summary views and related actions that update a single record. It can also be used in the process models for record actions where you need to act on new or updated record data after a Write Records node.

The table below outlines the key differences between these two functions:

  a!queryRecordByIdentifier() a!queryRecordType()
Number of base records returned One One or more
Number of related records per relationship Up to 250 Up to 100
Batching Automatic Configured with a!pagingInfo()
Query editor support No Yes

Note:  a!queryRecordByIdentifier_25r2() should not be used in a loop. If you need to query more than one base record or more than 100 related records, the related record type should be queried separately.

Using the fields parameter

By default, this function will return the fields from the base record type. If you also want to return related record fields, you can reference the fields or the relationship in the fields parameter.

To return… Use… Example fields value
A record field The recordType! domain to reference a record field. recordType!Case.fields.description
All record fields No reference. If you don't include the fields parameters, the function will return all record fields. N/A
A related record field The recordType! domain to reference a relationship and related record field. recordType!Customer.relationships.cases.fields.status
All related record fields from a relationship The recordType! domain to reference a relationship. recordType!Customer.relationships.cases

If you are querying a one-to-many relationship, a maximum of 100 related records will be returned. For example, when querying customers and their related support cases, the query will return up to 100 related support cases for the customer.

Using the relatedRecordData parameter

The relatedRecordData parameter allows you to filter, sort, and limit related record data from a one-to-many relationship using the a!relatedRecordData() function.

For example, let's say you're querying the Customer record type and you only want to return the last three cases associated with each customer. Since a customer can have many cases, by default, the query will return up to 100 cases related to each customer. In the relatedRecordData parameter, you could use the a!relatedRecordData() function to limit the result to three and sort the cases so the most recent appears first.

1
2
3
4
5
6
7
8
9
10
11
12
a!queryRecordByIdentifier_25r2(
  recordType: recordType!Customer,
  identifier: ri!id,
  relatedRecordData: a!relatedRecordData(
    relationship: recordType!Customer.relationships.case,
    limit: 3,
    sort: a!sortInfo(
      field: recordType!Customer.relationships.case.fields.entryDate,
      ascending: true
    )
  )
)

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. See additional usage considerations for using the a!relatedRecordData() function.

The a!aggregationFields() function is not supported with a!queryRecordByIdentifier_25r2().

If you need to aggregate related record data, use a!queryRecordType() instead.

New version details

The a!queryRecordByIdentifier() function was evolved to reinforce query performance best practices.

The new version of the function includes the following behavior changes:

  • Changed the fields parameter behavior so when the parameter is null or empty, only the primary key field from the base record type is returned. Likewise, only referencing a relationship will return the primary key fields from both the base and related record types.
  • The relatedRecordData parameter to accept a limit of up to 250 related records.

Feature compatibility

The table below lists this function's compatibility with various features in Appian.
Feature Compatibility Note
Portals Compatible
Offline Interfaces Partially compatible

Can be used with offline interfaces if loaded at the top of the interface.

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 Partially compatible

If autoscale is enabled, can be used to configure a supported process event node (such as a start event or timer event).

Process Autoscaling Compatible

Can be used in autoscaled processes.

Event Consumer Filter Conditions Incompatible

Cannot be used in filter conditions.

Event Consumer Event Handlers Incompatible

Cannot be used in event handler expressions.

Feedback