I am currently trying to set a flow variable based on ToAddress value that comes in via an E2C situation. I realized that there are multiple email addresses being stored in that text field. Sometimes it will come in with 1 adress....sometimes 5 that are all separated by colon. Is there a way to split one particular address from the group in the text field if it consistently starts with the same two letters via a formula?
1 Answer
Assuming you are referring to EmailMessage.ToAddress
field - then because this is a text area long field (length 4000), you will not be able to use formula expressions.
You will need to either:
- If doing this in a before insert/update context - use an Apex trigger
- If doing this in an after insert/save or screen flow context, use an invocable Apex action.
The Apex String class has a handy split
method that can split a string into an array based on a delimiter