Hi Appian Community,
I have added into my interface a grid as shown below, which was called from a record type.
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
Hi,How about having the richTextItem in the loop?Let me make it more clear for you.you can have the richTextItem in the loop and add link to each text item you get out of the loop.Then the code would look this way.
a!forEach( items: split(fv!row[recordtype.relatedTo], "|"), expression: a!richTextItem( text: fv!item, link: a!recordLink( label: fv!item, recordType: recordType, identifier: fv!item, openLinkIn: "NEW_TAB" ) ) )
Thanks for the guidance, It looks correct but somehow didn't work for me. I guess because I have the a!gridField outside of the code? I tried 2 ways but both failed...
a!gridColumn( label: "Related To", value: a!forEach( items: split(fv!row['recordType.Related To], "|"), expression: if( IsBlank(fv!row['recordType.relatedTo]), "-", a!richTextItem( text: fv!item, link: a!recordLink( label: fv!item, recordType: recordType, identifier: fv!item, openLinkIn: "NEW_TAB" ) ) )
), sortField: fv!row['recordType.Related To], align: "CENTER" ),
Another way:
a!gridColumn( label: "Related To", value: if( IsBlank( fv!row['recordType.relatedTo]), "-", a!forEach( items: split(fv!row[recordtype.relatedTo], "|"), expression: a!richTextItem( text: fv!item, link: a!recordLink( label: fv!item, recordType: recordType, identifier: fv!item, openLinkIn: "NEW_TAB" ) ) ), sortField: recordType, align: "CENTER" ),
Could you please share how the data is present in relatedTo column of your record type?
955|2870|303
This is one row of the relatedTo column, which data type is text, and the IDs are seperated by "|"
You said it did not work. What really did not work? The link is not showing up? it is showing up but not clickable? It is clickable but is not taking you to the correct screen?
Both ways I got
How are you referring the record fields?I hope you are using recordType!.Or can you share the exact code by any chance?
This is the original code. Hope it helps!
Can you please try this code for gridColumn?
a!gridColumn( label: "Relate To", value: if( a!isNullOrEmpty(fv!row[recordType.field]), "-", a!forEach( items: split(fv!row[recordType.field], "|"), expression: a!richTextItem( text: fv!item, link: a!recordLink( label: fv!item, recordType: recordType, identifier: tointeger(fv!item), openLinkIn: "NEW_TAB" ) ) ) ) )
Really appreciate your help but it did not work either, to be honest by looking at the code I thought it will certainly work...
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, "", " / " ) } ) ) ) } ) )