function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
María LoboMaría Lobo 

To get a substring from the TextBody

Hello,
I need to get an information from an Inbound email and set it in a field.
The information always will look as: DUNS: 123456789
I want to do it with a Process Builder, with a immediate action "Update Record". I am trying to fill up the field with the 9 numbers, but I don´t know how to do get the strings.
I did a Formula like this: TRIM(TEXT(FIND("DUNS:", [EmailMessage].TextBody  )+10))
But it just gets the: 12
Does anyone know how to do it?


 
Best Answer chosen by María Lobo
Mike ArthurMike Arthur
I haven't tested it but this may work:

MID( TEXT([EmailMessage].TextBody) , FIND("DUNS:", [EmailMessage].TextBody+6 ) , 9)

i.e trying to achieve it with the MID function - MID(text, start_num, num_chars)

All Answers

María LoboMaría Lobo
I´ve got the solution:
TRIM(MID([EmailMessage].TextBody, FIND("DUNS:", [EmailMessage].TextBody  )+5,10))
 
Mike ArthurMike Arthur
I haven't tested it but this may work:

MID( TEXT([EmailMessage].TextBody) , FIND("DUNS:", [EmailMessage].TextBody+6 ) , 9)

i.e trying to achieve it with the MID function - MID(text, start_num, num_chars)
This was selected as the best answer
María LoboMaría Lobo
Thank you  very much for your answer Mike!
Mike ArthurMike Arthur
Excellent - Thanks Maria!