Microsoft Automate / Flows: Remove Duplicates From an Array Variable.
Updated: Sep 3, 2020
Microsoft Flow is a very powerful tool when it comes to run heavy-duty workflows for long hours or the small automation needed to make the process more efficient and effective.
However there is one drawback which is a feature that it forces you to write less code, and if you not aware of all those dynamic expressions and formulas things can get tricky.
One thing which I faced was removing duplicates from the array variable in my flow. At first, I thought I will write a web-hook Azure function to remove duplicates and return the array back in flow.
Pro tip: you can call Azure functions in a flow although there is no connector for azure functions as we get in Logic app , but you can call a web-hook triggered Azure function and get the response.
Use of Joins and Union () in flow.
In my Scenario, I'm a getting a large number of contact GUIDs which are duplicate, and I have to send them an email once, so I had to filter the array which I received.
In The Below Image: We have an array variable named as Product Leader, to remove duplicates we used the Union function in the last step.
I hope you enjoyed reading this article and learned something new!!! If you have any questions or comments about this topic, please let me know in the comments section below. I will also post other useful information for my connections on linkedin about D365 and other Microsoft related news, so we can all learn new things together.
Thank you for reading and until next time!