Add record link to each part of a text string

Hi Appian Community,

I have added into my interface a grid as shown below, which was called from a record type. 

ID     relateTo Column 3 Column 4
001 003/004
002 007/004/005
003 001/002/006
004
005
006
007

This is the code that I wrote for column 2 (relatedTo) but didn't work. I used split () to split each row into an array of text IDs, then trying to add link to each of that ID. 


a!richTextItem(
     text: split(fv!row[recordtype.relatedTo], "|"),
     link:  a!forEach(
              items: split(fv!row[recordtype.relatedTo], "|"),
              expression: a!recordLink(
                                       label: fv!item,
                                       recordType: recordType,
                                       identifier: fv!item,
                                       openLinkIn: "NEW_TAB"
        )

    )

)


I want to add link to each ID in column 2 (ID that related to ID in column 1), so when I click any in that text string, I can be directed to the record for that certain ID. I think the identifier needs to be specific but not sure how to do it.

Thanks for your help, and appologise if the code is confusing...

  Discussion posts and replies are publicly visible

  • +1
    Appian Employee
    in reply to mollyn126

    You're missing the a!richTextDisplayField() - you can't just put a!richTextItem() by itself, it must be contained within a Rich Text Display Field.

    Here's a working example if you want to check it out:

    a!localVariables(
      local!data: {
        a!map(id: 1, value: "1/2/3"),
        a!map(id: 2, value: "4/5/6")
      },
      a!gridField(
        data: local!data,
        columns: {
          a!gridColumn(
            label: "ID",
            value: fv!row.id
          ),
          a!gridColumn(
            label: "Value",
            value: a!richTextDisplayField(
              value: a!forEach(
                items: split(fv!row.value, "/"),
                expression: {
                  a!richTextItem(
                    text: fv!item,
                    link: a!recordLink(
                      recordType: 'recordType!{4c49fecf-28fc-447d-8acd-0547f4b609e6}PDL Case',
                      identifier: fv!item
                    ),
                    linkStyle: "STANDALONE"
                  ),
                  if(
                    fv!isLast,
                    "",
                    " / "
                  )
                }
              )
            )
          )
        }
      )
    )

  • You're right!! a!richTextDisplayField then richTextItem inside of it is what I should do. Thanks a lot Smiley