Reference a Record Type in Expressions

This page describes how to reference a record type and record fields in an expression and interface. We'll also discuss how to bring in the record data and other features configured on the record type.

Overview

You can directly reference the record type object in your expression or interface using the recordType! domain. This domain prefix is a direct object reference that removes the need to create a constant to reference your record type, except in specific use cases. See when to use a constant.

Record type object references also allow you to reference fields, filters, and actions configured on the record type for use in an expression, interface, record action component, or a read-only grid.

In addition to the sections below, see the following topics for more information:

Referencing a record type

You can use the recordType! domain to reference the record type in functions, such as a!queryRecordType() and urlforrecord(), and components, such as a!recordLink() or a!pickerFieldRecords(). For example, recordType! is used to reference the Engineering Team record type in the a!queryRecordType() function.

/record type queryrecordtype function example

This expression queries the Engineering Team record type and pulls in the data for the selection of record fields defined in the function. It also filters the results to show the teams that match isFeatureTeam and sorts the data so the results are ordered and grouped by the engineering team name.

Utilizing typeahead with the recordType! domain takes the guesswork out of remembering the exact name of the record type you want to reference in your expression or function. After entering the recordType! domain in a function or expression, typeahead suggests a selection of existing record types and allows you to select and reference the one you want. If you find that you are unable to reference a specific record type, make sure that you have access to it.

See urlforrecord(), Record Link, Record Picker Component, a!queryRecordType(), and Record type security for more information.

The record type object reference combined with . dot notation allows you to directly access properties of the record type like fields, actions, filters, and relationships in your functions or expressions. You can easily reference these same properties within a read-only grid or chart that uses a record type as the data source using the recordType! domain. We'll discuss how to reference each record property in the subsequent sections.

Referencing record fields and field values

Once you define the source of your record type, you can easily reference a record field in an expression or interface using the fields property. This property allows you to reference any record field configured on the record type; If your record type has data sync enabled, this includes custom record fields.

To reference a record field, you'll use the recordType! domain and . dot notation. Simply append . dot notation to the record type object reference to autosuggest the fields property on the record type. You can then index into a specific record field, which is autosuggested from a list of available record fields. Note that record fields cannot be referenced using a constant.

This example demonstrates how to reference the firstName field in the Employee record type. Since record type object references and record type field references are specific to each environment, this example does not evaluate in your Test Rules interface. Use it only as a reference.

  1. In an expression rule object, use the recordType! domain to reference a specific record type. For example, the record type reference shown refers to the Employee record type.

    record type employee lozenge

  2. Use . dot notation after recordType!<Record Type Name> to autosuggest the actions, fields, filters, and relationships properties configured on the record type.
  3. Select fields to access the hierarchical menu of record fields on the Employee record type.

    /record type employee fields lozenge autosuggest

  4. Select a record field key from the fields dropdown to append to the fields property. For example, the reference shown refers to the first name field of the Employee record type.

    /record type employee fields lozenge firstname

When you highlight a record key from the dropdown, Appian automatically provides additional information about the record field key, including:

  • Full record type field reference
  • Field name
  • Field data type

When using a record type field reference, Appian will automatically shorten the reference to improve the readability of your expressions. To display the full reference, simply hover over it.

Referencing record values in the record type

To reference record values within the record type object itself, use the record values rv! domain prefix. The rv! domain allows you to reference a record's ID or a value within a record field.

In the record type object, you'll use rv! to reference record field values when you configure any of the following:

  • A view definition expression
  • An expression for the record title on a record view
  • A view's action visibility expression
  • A feed-style list expression

To reference a record value in the record type object, use the rv! domain followed by either record or identifier. When you want to return the ID for a specific row in the record and pass it into an interface or process, use rv!identifier. When you want to pass a reference to the record itself into a record view, use rv!record with a field reference wrapped in bracket notation, rv!record[recordType!<record type name>.fields.<field name>].

You will also use rv! to access the value of a record field in an expression, like an expression you might use to define the record title for a record view. For example, we can use rv!record to configure the Record Title for the Employee summary view. The example shown displays the rv!record with a record type field reference to reference the firstName field in the Employee record type.

/grid howto/record type field reference rv example

When using field references in the record type object, you can also begin to type the fieldName after recordType!<record type name>.fields. and autosuggest will provide a list of record type field names that match your entry.

For record types that use a process model as the source, you can use rv!record with a record type field reference wrapped in bracket notation to point to a process or a specific process-model property. For example, rv!record[recordType!Record.fields.pp.initiator] will return the initiator of a process.

See Domain Prefixes for more information on the rv! domain.

Referencing a record action

After configuring a record list action or related action for a record type, you can use the recordType! domain to reference the record action in an interface or expression. You'll simply append . dot notation to the record type object reference to autosuggest the actions property on the record type. Autosuggest will display a list of available record actions that are available for you to reference.

Note that record actions cannot be referenced using a constant.

The example shown demonstrates how to reference the updateEmployee action configured on the Employee record type. Since record type object references and action properties on the record type are specific to each environment, this example will not evaluate in your environment. Use it only as a reference.

  1. In an expression rule object, use the recordType! domain to reference a specific record type. For example, this record type reference refers to the Employee record type.

    record type employee lozenge

  2. Use . dot notation after recordType!<Record Type Name> to autosuggest actions, fields, filters, and relationships.
  3. Select actions to access the hierarchical menu of actions configured on the Employee record type.

    /record type employee actions menu

  4. Select a record action key from the actions menu to append to the actions property. The example shown references the updateEmployee record action configured on the Employee record type.

    /record type employee actions lozenge update

When you highlight a record action key from the dropdown, Appian automatically provides additional information about it, including:

  • Full record type action reference
  • Action description
  • Record type name
  • Action name
  • Process model that supports the record action
  • Action context
  • Visibility setting

When using a record type action reference, Appian will automatically shorten the reference to improve the readability of your expressions. To display the full reference, simply hover over it.

See also: Record Action Component

Referencing a user filter

After configuring a user filter on a record type, you can use the recordType! domain to reference the user filter in an interface or expression. Append . dot notation to the record type object reference to autosuggest the filters property on the record type. Autosuggest will display a list of available user filters for you to reference.

The example shown demonstrates how to reference the Department user filter configured on the Employee record type. Since record type object references and filter properties on the record type are specific to each environment, this example does not evaluate in your Test Rules interface. Use it only as a reference.

  1. In an expression rule, use the recordType! domain to reference a specific record type. For example, this record type reference refers to the Employee record type.

    record type employee lozenge

  2. Use . dot notation after the recordType!<Record Type Name> to autosuggest actions, fields, filters, and relationships configured on the record type.
  3. Select filters to access the hierarchical menu of user filters configured on the Employee record type.

    record type employee lozenge filters

  4. Select a user filter key from the filters dropdown to append to the filters property. This example references the Department filter configured on the Employee record type.

    record type employee lozenge department filter

When using a record type action reference, Appian will automatically shorten the reference to improve the readability of your expressions. To display the full reference, simply hover over it.

Referencing a relationship

After adding a relationship to a record type with data sync enabled, you can use the recordType! domain to reference a relationship and select a related record field.

To reference relationships in an expression, simply append . dot notation to the record type object reference to autosuggest the relationships property. Autosuggest will display a list of relationships defined on the record type.

Once you select the relationship, append . dot notation again to autosuggest the fields and relationships properties on the related record type. Use the fields property to index into a specific related record field, or use the relationships property to index into a relationship defined on the related record type. By indexing into a related record type's relationship, you can select fields from record types that are not directly related to the base record type.

The example below demonstrates how to use the Office Supply Orders record type to reference the customerName field in a related record type. Since record type object references and relationship properties on the record type are specific to each environment, this example does not evaluate in your Test Rules interface. Use it only as a reference.

  1. In an expression rule, use the recordType! domain to reference a specific record type. For example, this record type reference refers to the Office Supply Orders record type.

    record type order lozenge

  2. Use . dot notation after the recordType!<Record Type Name> to autosuggest actions, fields, filters, and relationships configured on the record type.
  3. Select relationships to access the hierarchical menu of relationships defined on the Office Supply Orders record type.

    record type order lozenge relationships

  4. Select a relationship key from the dropdown to append to the relationships property. This example references the customer relationship.

    record type order lozenge customer relationship

  5. Use . dot notation after the selected relationship to autosuggest fields and relationships configured on the related record type. This example uses the fields property.

    record type order lozenge customer relationship field

  6. Select a related record field key from the dropdown to append to the fields property. For example, the reference below refers to the name field on the Customer record type.

    record type order lozenge customer relationship field details

Appian provides additional information about the relationship key and the related record field key.

When you highlight a relationship key from the dropdown, the following information is presented:

  • Shortened record type relationship reference
  • Relationship name
  • Related record type name
  • Relationship type
  • Full record type relationship reference
  • Properties on the related record type that can be indexed into

When you highlight a related record field key from the dropdown, the following information is presented:

  • Shortened related record field reference
  • Related record field name
  • Related record field data type
  • Full record type relationship reference

See also: Record Type Relationships

Referencing process properties

Process properties can be referenced in record types that use a process model as the source. The following sections list the process and process model properties available to the record type.

To reference a process property, use the process property prefix (pp.) in front of the reference. This must still be from within the record field (rv!) domain: rv!record[recordType!<record type>.fields.pp.<reference>]

All process properties in the table can be referenced this way. For example, to reference the process Start Time, use rv!record[recordType!Record.fields.pp.startTime].

Process Property Reference Type Description
ID id Integer System-assigned ID for the process. Process IDs are unique within an Appian instance. They are not reused, and can be used to reference the process throughout the application.
Name name Text Name of the underlying process model.
Priority priority Text The value set as the process priority. Note: this is a descriptive property. It is available to designers to use how they see fit, but the property itself does not affect how Appian handles the process.
Initiator initiator User The user who started this process.
Designer designer User Owner of the underlying process model. If there are multiple process administrators, the user who last updated the process model becomes the owner.
Start Time startTime Date/Time Time the process was started.
Deadline deadline Date/Time The date/time value set as deadline. Note: this is a descriptive property. It is available to designers to use how they see fit, but the property itself does not affect how Appian handles the process.
Time Zone timeZone Text Time zone context used by the process. This value may differ from the configured process model time zone, such as when the designer selects the option to override the configured process model time zone with the process initiator's time zone. See also: Time Zone Context

Referencing process model properties

Process model properties can be referenced in record types that use a process model as the source.

To reference a process model property, use the process property prefix (pm.) in front of the reference. This must still be from within the record field (rv!) domain: rv!record[recordType!<record type>.fields.pm.<reference>]

All process properties in the table can be referenced this way. For example, to reference the process model Time Zone, use rv!record[recordType!Record.fields.pm.timeZone].

Process Model Property Reference Type Description
ID id Integer System-assigned ID for the process model. Not to be confused with the UUID.
Name name Text Name of the process model.
Description description Text Description of the process model.
Version version Text Version of the process model.
Creator creator User Creator of the process model.
Time Zone timeZone Text Time zone the process model was created in.
UUID uuid Text Unique identifier for the process model application object.

When to use a constant

There are specific use cases that still require you to use a constant to indirectly reference a record type. For example, when using the Report Builder to create basic grids and charts from a record type, you must first save the record type as a constant and use the constant to select the record type in the Report Builder. You must also use a constant or expression rule to reference a record type in an existing process model.

See Use the Report Builder and Working with Data in Process for more information.

Referencing record data in an interface

Record data type

All record type objects have their own unique data type, which is specific to each record type and automatically generated when the record type is created. The record data type allows you to easily access the data associated with a specific record type and use field references to call the record data into your expressions and interfaces.

For interfaces connected to a record type, such as record views, you can pull in record data by using the record data type as a rule input in your interface. When you add the interface as a view for your record type, simply pull the record data into the rule input using rv!record. If your interface only needs to reference a record type, but not pull in record data, you can use your record type as a rule input. For examples of how to use record data types as rule inputs in interfaces and views, see Create a Record View.

Any configuration changes that you make to your record type are automatically captured by the record data type so your record data and fields always stay current. This reduces the need to duplicate any configuration changes that you make to the record type object across multiple objects that use the record data.

Casting record data

You can cast the record data type to a dictionary, a map, a CDT, or string. The record data type supports casting in both directions as long as the fields you want to cast are present in the record type. If you've defined relationships on your record type, you can also cast the related record data from the record data type to a dictionary, a map, a CDT, string, or to another record data type that has the same values.

See Casting record data, Casting related record data, and cast() Function for more information.

Using a record type constructor

You can use a record type constructor to create a single record in your expression. The record type constructor allows you to map each value to a particular field reference or relationship reference in the record type.

For example, we'll use the record type constructor to construct a Support Case record. In the expression, we'll reference the record type fields and a record type relationship followed by a : colon and its corresponding data value on the right. After the relationship reference, we'll reference the related record type and create a nested constructor to define the related employee information for this record.

/Record-type-constructor-example-2

After entering the record data, you can click TEST RULE to view the data output.

/record-type-constructor-example-2-output

Open in Github Built: Mon, Nov 15, 2021 (03:03:53 PM)

On This Page

FEEDBACK