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>", "<", ">") ) ) )
> 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)
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...
do you still get that error if you add the (required) ":" after "mailto"?
ed: i don't get the error in my CE site...
Yes, I caught that typo and fixed it, but still receive that error message. Strangley though it didn't give me the error when it was first implemented...
a!safeLink [line 81]: mailto: is not a permitted URI under the configured security rules and cannot be cast to safeUri.
Works in my CE site (and in the shared beta site). If you just make a new unsaved interface with this code do you still get the same error?
mailto: -- needed to be mailto://
All set! Thank you!
weird, it actually works for me when i try it either way.
Scott Fleming said:needed to be mailto://
According to this
https://www.w3docs.com/snippets/html/how-to-create-mailto-links.html
there are no "//" in a valid mailto link.