Skip to main content
scottf0004
May 29, 2024
Question

How to parse field to extract email address and display mailto link

  • May 29, 2024
  • 22 replies
  • 0 views

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 - 

22 replies

stefanhelzle0001
Brainy
May 29, 2024

a!richTextDisplayField(
  value: a!richTextItem(
    text: extract("Bilbo Baggins ", " ", "<"),
    link: a!safeLink(
      uri: "mailto:" & extract("Bilbo Baggins ", "<", ">")
    )   
  )
)

scottf0004
June 6, 2024

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 

stefanhelzle0001
Brainy
June 6, 2024

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 ",
  a!richTextDisplayField(
    value: a!richTextItem(
      text: mid(local!email, 1, find(" <", local!email)),
      link: a!safeLink(
        uri: "mailto:" & extract(local!email, "<", ">")
      )   
    )
  )
)

mikes0011
Brainy
May 29, 2024