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, "<", ">") ) ) ) )
> extract("Bilbo Baggins <Bilbo.Baggins@TheShire.org>", " ", "<"),
By my math, that would evaluate to a text value of "Baggins " - is that the intent?
(i guess it doubles it based on the fact that there are 2 copies of the "start delimiter" i.e. a blank space)
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!
How do I get just the 1st element of a split?
don't use split() for this. See my and Stefan's other replies above.
a!richTextDisplayField( value: a!richTextItem( text: a!localVariables( local!fullString: fv!row['recordType!{a7958e69-8bde-42a9-a773-23e5104be70a}HAP Application.fields.{f3a77ebb-d7b9-4ec4-bd04-674ed104e96e}technicalPointOfContact'], extract( "--beginning--" & local!fullString, "g--", " <" ) ), link: a!safeLink( uri: "mailto://" & extract(fv!row['recordType!{a7958e69-8bde-42a9-a773-23e5104be70a}HAP Application.fields.{f3a77ebb-d7b9-4ec4-bd04-674ed104e96e}technicalPointOfContact'], "<",">") ) ) )
The Requested Record Type Is Not Available Expression evaluation error [evaluation ID = 6CT8A] at function a!recordList: A grid component [label="null"] has an invalid value for "columns". A grid column [label="Technical Contact"] has encountered an error. Expression evaluation error at function a!safeLink [line 94]: mailto: is not a permitted URI under the configured security rules and cannot be cast to safeUri. (APNX-1-4198-000)
Bah! Most likely because I'm using the unpaid community edition...