Free cookie consent management tool by TermsFeed Reference a Record Type in your Applications [Appian Records]
Reference a Record Type in your Applications

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, read-only grid, or chart.

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

In some cases, you may need to reference record values within the record type itself. For example, if you want the record title to display the customer name, you'd need to reference data within the recordType!Customer.fields.name field so the correct name is listed on each record view.

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

You can only use this domain within the record type object, and you can use it to configure:

To reference a record value in the record type object, use the rv! domain followed by either identifier or record:

  • rv!identifier allows you to reference a record's ID. You'll often use this when you want to pass a record into an interface or process model.

    For example, rv!identifier is used in the Context of a related record action to pass an individual record into a process model.

  • rv!record allows you to reference the data within a specific record field. To use this, you must follow this domain with a field reference wrapped in bracket notation (like rv!record[recordType!<Case.fields.title]). You'll use this when you want to pass a record into a record view or populate a record title.

    For example, rv!record is used to define the Record Title so the appropriate customer name appears on each record view.

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

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. Learn more.

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: Add Record Type Relationships

Referencing record data in an interface

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

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, you must use a constant or expression rule to reference a record type in an existing process model. See Working with Data in Process for more information.

Open in Github Built: Fri, Dec 01, 2023 (07:12:35 PM)

Reference a Record Type in your Applications

FEEDBACK