Microsoft Automate / Flows: Remove Duplicates From an Array Variable.
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.