In my flow, I have read email addresses from a list into an array variable.
I have some duplicate email addresses in there and I would like to keep one version only.
How can I remove duplicates and build up a string of email addresses, seperated by semicolons, to use in the To: field of the email to be sent?
So address1; address2;address3;address4 etc
Thank you
Solved! Go to Solution.
Hi @sienna28,
Could you please share a screenshot of your flow’s configuration?
You can try to use Union to remove the duplicate email address and use join with(;)to change "," to ";".
I have tested as next.
Step1: create one SP list(the list has two same eamil adress to test).
Step2:Configure the flow: Use Union and Join
Step3:check it and then test
Hope this can be helpful.
BR,
xyz
Thanks for your help in this thread @xyzzyx666!
@sienna28 thanks for your post - can you review the information provided and let us know if it answers your question?
@Anonymous
Hi @sienna28,
Could you please share a screenshot of your flow’s configuration?
You can try to use Union to remove the duplicate email address and use join with(;)to change "," to ";".
I have tested as next.
Step1: create one SP list(the list has two same eamil adress to test).
Step2:Configure the flow: Use Union and Join
Step3:check it and then test
Hope this can be helpful.
BR,
xyz
Thanks for your help in this thread @xyzzyx666!
@sienna28 thanks for your post - can you review the information provided and let us know if it answers your question?
@Anonymous
Hi,
Could you please share what the actions are? The screenshots provided are very hard to read.
@Anonymous wrote:Thanks for your help in this thread @xyzzyx666!
@sienna28 thanks for your post - can you review the information provided and let us know if it answers your question?
@Anonymous
hi,
this solution doesn't show what you append to the array variable?
also doesn't show the exact expression you used for Compose/Join?
could you please clarify?
You can just perform the union against the same array to remove duplicates.
In the compose expression:
union(variables('emails'), variables('emails'))
to store the result back into an array just use a Set Variable and type "Outputs" in the dynamic content search option and locate the Outputs specific to the naming of the compose expression that you put the union code in.
A faster way to remove duplicates is to union the input array with an empty array. This saves a lot of time with larger sets.
Initialize an empty array using Compose and use another Compose to union the input array with the empty array.
@xyzzyx666 the combination of union() and join() does the trick. Ingeniously simple, thank you!
Whatever I tried returned escaped double quotes as in
'emailMessage/To' is required to be of type 'String/email'. The runtime value '"[\"username@company.com;\"]"' to be converted doesn't have the expected format 'string/email'.
I didn't need a compose action, actually:
Makes most sense! I shall definitely try that next time. Now I have just a couple of dozens of email addresses, no worries.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
175 | |
46 | |
46 | |
34 | |
33 |
User | Count |
---|---|
258 | |
87 | |
78 | |
68 | |
67 |