I am working in my record type display interface.
One of the fields in our data contains an email address with the name of the person in this format:
Bilbo Baggins <Bilbo.Baggins@TheShire.org>
I need to extract the string between the < > and display that string as a mailto link in my results.
How do I write this, or if it's not possible to write this, how can this be achieved based on the data as it is?
Many thanks in advance -
Discussion posts and replies are publicly visible
a!richTextDisplayField( value: a!richTextItem( text: extract("Bilbo Baggins <Bilbo.Baggins@TheShire.org>", " ", "<"), link: a!safeLink( uri: "mailto:" & extract("Bilbo Baggins <Bilbo.Baggins@TheShire.org>", "<", ">") ) ) )
First, thank you for your help!
The mailto:link is returning correctly, but the display name is not showing the string to the left of the "<" properly.
For example:
Joseph Nault <Joseph.Nault@tn.gov> ---> link displays as "Nault Nault"..
Here's the code:
Screenshot of the result
Sorry, the "Bilbo" looks so similar to "Baggins" so that I missed this ...
I changed the code a bit:
a!localVariables( local!email: "Bilbo Baggins <Bilbo.Baggins@TheShire.org>", a!richTextDisplayField( value: a!richTextItem( text: mid(local!email, 1, find(" <", local!email)), link: a!safeLink( uri: "mailto:" & extract(local!email, "<", ">") ) ) ) )
mid() seems like a reasonable approach - my old trick, though, when wanting a more carefully guided "extract", is to prepend a special delimiter string (something unlikely/impossible to ever appear in the actual string itself) --
Magic Mike! A great trick!