Skip to main content
January 25, 2024
Question

how could I simplify this richText syntax?

  • January 25, 2024
  • 9 replies
  • 0 views

{

a!richTextHeader(
text: local!vehicle['recordType!{99b0bb09-e2c0-4f75-a70b-26f247e2d095}AA Vehicle.fields.{41ba4a5a-f36f-474a-b17d-c12f6869260f}make'],
size: "MEDIUM"
),
a!richTextItem(
text: {local!vehicle['recordType!{99b0bb09-e2c0-4f75-a70b-26f247e2d095}AA Vehicle.fields.{19858bdc-1ba7-46b0-8f44-c9bdcbd61fca}model']}
)
}

I am just wondering how could I write only once the "recordType!{99b0bb09-e2c0-4f75-a70b-26f247e2d095" them be able to get the value in a less verbose way

I mean I don't think this sintaxe `local!vehicle[recordType!AA Vehicle.fields.year]` is ok for each field I want to add.

it should exist something to reduce that syntax and then make it able to just "vehicle.field, vehicle.year, vehicle.color"... Thanks in advance

9 replies

konduruc733182
January 25, 2024

Hello silasf1681,

"vehicle.field, vehicle.year, vehicle.color"


This works fine if you have a CDT or a map and not for RecordTypes. AFAIK You will have to follow this I guess. Its either this or the Index function which would require a little bit more writing.

[quote userid="261985" url="~/discussions/f/user-interface/31247/how-could-i-simplify-this-richtext-syntax"]`local!vehicle[recordType!AA Vehicle.fields.year]`[/quote]

harshitb6843
January 25, 2024

What I use as my productivity hack is to have a rule input with the correct record as their data type. Now you can simply use dot operator and start typing your field name and it will also format it once you select. 

Once you do it everywhere on the screen, you can just replace the "ri!student" with your local variable. 

konduruc733182
January 25, 2024

Yes, I totally forgot this trick. Actually a good trick to reduce time and lot of typing work.

mathieud0001
Brainy
January 26, 2024

I don't recommend this for all cases but there is always the option of casting your Record to a map.

a!localVariables(
  local!recordMap: cast(typeof(a!map()), ri!LM_Account),
  a!richTextDisplayField(
    value: a!richTextItem(
      text: local!recordMap.id
    )
  )
)

stefanhelzle0001
Brainy
January 26, 2024

All Appian data types can be referenced using the "type!<Type>" syntax. For maps it would be "type!Map". This way we do not have to first create a map data structure, just to extract its data type.

mathieud0001
Brainy
January 26, 2024

I know. But it doesn't work with auto-complete which is why I always end up reverting back to typeof(). [emoticon:c4563cd7d5574777a71c318021cbbcc8]