
Announcements
Hi,
I'm creating a flow to save email attachments and trying to name them after one of the people CC'd. However, when I try to get the user profiles, the flow fails as the string values for the parameters are null. Ultimately, I want to get the two email addresses that are CC'd, and remove one of them to get just one profile (this one to be removed is always the same). Any suggestions on what to do?
Hi @Anonymous,
In this example you could use a split function to split the two e-mail addresses based on the ; character.
Below is an example:
In this example I am retrieving the second item by using index [1]. The first could be retrieved via [0]
split(triggerOutputs()?['body/ccRecipients'], ';')[1]
However, this expression only works if the CC field always contains 2 email addresses. If you want to get a working expression for only 1 e-mail in CC or even when it is empty it needs to be an expression like below.
In this example I am using an empty to check if it is empty and an indexOf to check if there is a ; character (which means it has at least two e-mail addresses).
if(empty(triggerOutputs()?['body/ccRecipients']), 'Empty', if(equals(indexOf(triggerOutputs()?['body/ccRecipients'], ';'), -1), triggerOutputs()?['body/ccRecipients'], split(triggerOutputs()?['body/ccRecipients'], ';')[1]))