Free cookie consent management tool by TermsFeed

a!selectionFields() Function

On This Page

Returns all fields from a record type and any of its related record types within a query. You can also query specific fields from other record types at the same time.

Related functions:

Parameters

a!selectionFields( allFieldsFromRecordType, selectFields, includeRealTimeCustomFields, includeExtraLongTextFields )

Keyword Type Description

allFieldsFromRecordType

Record Type

The record type and related record types you want to query all fields from. To query all fields from the base record type, reference it directly using the recordType! domain, such as recordType!Customer. To query all fields from a related record type, use a relationship reference from the base record type, such as recordType!Customer.relationships.order. By default, real-time custom record fields and Extra Long Text fields are excluded because they can impact query performance. Use the selectFields parameter to specify individual fields to query from the record types, or to include specific real-time custom fields or extra long text fields. For optimal performance, only reference the record types for which you need all fields.

selectFields

Record Fields

Specific fields for the query to retrieve. To query fields from the base record type, reference it directly using the recordType! domain, such as recordType!Customer.fields.firstName. To query fields from a related record type, use a relationship reference from the base record type, such as recordType!Customer.relationships.order.fields.total.

includeRealTimeCustomFields

Boolean

Determines if real-time custom record fields are queried from the record types specified in the allFieldsFromRecordType parameter. Default is false to exclude these fields since they can impact query performance. Use the selectFields parameter to include specific real-time custom record fields in the query instead of querying all of them.

includeExtraLongTextFields

Boolean

Determines if Extra Long Text fields are queried from the record types specified in the allFieldsFromRecordType parameter. Default is false to exclude these fields since they can impact query performance. Use the selectFields parameter to include specific Extra Long Text fields in the query instead of querying all of them.

Returns

Record Fields

Using the function

When to use this function

The a!selectionFields() function allows you to return all record fields or related record fields in a query by referencing the record type or relationship. However, you should only use this function when you need all fields in your interface or expression—there's no need to query data that you're not going to use.

If you don't need all of the fields, use individual field references in your queries instead of using this function.

Where to use the function

You can use the a!selectionFields() function in the fields parameter of the following functions:

Both the allFieldsFromRecordType and selectFields parameters require you to use relationship references when referencing related record types or their fields. For example, recordType!Customer.relationships.order. You cannot pass a direct recordType! reference to a related record type (such as recordType!Order).

See Return all record fields and all related record fields, except expensive fields for an example.

Using the allFieldsFromRecordType parameter

The allFieldsFromRecordType parameter allows you to query all fields from a record type and any of its related record types. By default, the parameter returns all fields except for real-time custom record fields and Extra Long Text fields. These fields require more resources and time to retrieve, so they're often called expensive fields.

If you need to include real-time custom record fields or Extra Long Text fields in a query, reference those specific fields in the selectFields parameter. See the Return all record fields and certain related record fields example.

Using the selectFields parameter

You can use the selectFields parameter in addition to the allFieldsFromRecordType parameter. This is useful when you need to return all fields from a record type, and only one or two fields from a related record type.

For example, you may need to return all fields from the Customer record type, but only one or two fields from the related Order record type. You could specify the Customer record type in the allFieldsFromRecordType parameter, and use the selectFields parameter to specify those two additional fields from the Order record type. See the Return all record fields and certain related record fields example.

You can also use this parameter to specify specific real-time custom record fields or Extra Long Text fields to include in the query instead of returning all of those field types using the includeRealTimeCustomFields or includeExtraLongTextFields parameters. See the Return all record fields and a specific real-time custom record field example.

Examples

The following examples demonstrate the a!selectionFields() function.

These examples reference an AR Customer record type from another environment. If you try to use these record type references in your environment, they return an error. Use these examples as a reference only.

Return all record fields except expensive fields

The following query returns all fields from the AR Customer record type except for any real-time custom record fields or Extra Long Text fields.

1
2
3
4
5
6
7
8
9
10
a!queryRecordType(
  recordType: recordType!AR Customer,
  fields: a!selectionFields(
    allFieldsFromRecordType: recordType!AR Customer
  ),
  pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 1
  )
).data

Returns

Scroll or drag to pan · ⌘+/⌘− to zoom · Esc to closeimages/selectionFields/allDefaultFields.png

Return all record fields and a specific real-time custom record field

The following query returns all fields from the AR Customer record type and the real-time custom record field called orderCount.

1
2
3
4
5
6
7
8
9
10
11
a!queryRecordType(
  recordType: recordType!AR Customer,
  fields: a!selectionFields(
    allFieldsFromRecordType: recordType!AR Customer,
    selectFields: recordType!AR Customer.fields.orderCount
  ),
  pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 1
  )
).data

Returns

Scroll or drag to pan · ⌘+/⌘− to zoom · Esc to closeimages/selectionFields/allFields-and-rtcrfs.png

The following query returns all fields from the AR Customer record type and three fields from the related AR Order record type.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
a!queryRecordType(
  recordType: recordType!AR Customer,
  fields: a!selectionFields(
    allFieldsFromRecordType: recordType!AR Customer,
    selectFields: {
      recordType!AR Customer.relationships.order.fields.createdOn,
      recordType!AR Customer.relationships.order.fields.assignee,
      recordType!AR Customer.relationships.order.fields.total
    }
  ),
  pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 1
  )
).data

Returns

Scroll or drag to pan · ⌘+/⌘− to zoom · Esc to closeimages/selectionFields/allFields-and-someRelatedFields.png

The following query returns all fields from the AR Customer record type and the related AR Order record type, except real-time custom record fields and Extra Long Text fields.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
a!queryRecordType(
  recordType: recordType!AR Customer,
  fields: a!selectionFields(
    allFieldsFromRecordType: {
      /* Base record type: use the recordType! domain directly */
      recordType!AR Customer,
      /* Related record type: use a relationship reference from the base record type */
      recordType!AR Customer.relationships.order
    }
  ),
  pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 1
  )
).data

Returns

Scroll or drag to pan · ⌘+/⌘− to zoom · Esc to closeimages/selectionFields/allFields-and-allRelatedFields.png

The following query returns all fields from the AR Order record type and the related AR Customer record type, including all real-time custom record fields and Extra Long Text fields.

Note:  This example starts from the AR Order record type because Extra Long Text fields cannot be queried from a one-to-many relationship, so the only way to return that field is by querying the AR Order record type and related fields from the AR Customer record type.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
a!queryRecordType(
  recordType: recordType!AR Order,
  fields: a!selectionFields(
    allFieldsFromRecordType: {
      recordType!AR Order,
      /* Navigate through the relationship to include the related record type */
      recordType!AR Order.relationships.customer
    },
    includeExtraLongTextFields: true,
    includeRealTimeCustomFields: true
  ),
  pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 1
  )
).data

Returns

Scroll or drag to pan · ⌘+/⌘− to zoom · Esc to closeimages/selectionFields/allFields.png

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 Compatible

Can be used to create a custom record field that only evaluates at sync time.

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 Compatible

Can be used in filter conditions.

Event Consumer Event Handlers Compatible

Can be used in event handler expressions.

Feedback