In this particular case I am trying to use FLOW to help automate some inventory management scenarios. Specific scenario:
I have x number of machines in y number of labs. Those machines have warranty end dates and users/owners.
I want to be able to create a workflow that does the following:
Pull list of all servers with building information, owner information, warranty information, and basic device information.
I want to then send a dynamically generated but individualized e-mail to each of the device owners with the device info and a message requesting follow-up action for devices that are approaching the end of the warranty. IE: I want Bob to get an e-mail that lists his devices and his device only. I want Sally to get an e-mail that lists her device and her devices only.
I want FLOW to recursively run through the list of owners and send them mail if they have any devices matching the selected warranty criteria.
My data source is Kusto. I've been able to connect to Kusto to pull a list of devices as needed and I can pull a user list and send individual mails. Where I'm currently stuck is that the e-mail, while sending only to the individual users, still includes all devices. How do I take my generated e-mail list and have it recursively run through the device list to filter for and include only the devices where the person in the to: line is also the device owner in the query?
Current flow basically runs in the following:
1. Schedule run time at 3:00 PM
2. Query Kusto for devices list
3. Query Kusto for unique e-mail list (this is just a re-run of a subset of query in step 2)
4. Send mail v2 "for each" e-mail address with attached device list from step 2
The missing step which I haven't quite figured out as part of step 4 or an extra step between 3 and 4:
"for each" e-mail address, find all devices from step 2 where the address is the same as the device owner and include only those devices.
After you get the list of the devices, you can get extract all emails from the list, there will have repeated emails, you can use the union() function to get a list with no-repeat emails. After that, put the array (no-repeat emails) into Apply to each action, get all lists of the devices again and create the Filter array action into the loop to find the devices that have the same e-mail address.
Best Regards, Community Support Team _ Lin Tu If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.