cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Microsoft
Microsoft

Using Get items to create multiple arrays

I have a sharepoint List of something like:

 

Name    | Company | Title      | Owner   | Follow Up Date

Morgan | Acme1     | Worker | sourcer1@ | 7/3/2020

John      | Acme2     | Worker | sourcer1@ | 7/3/2020

Sara      | Acme3      | Boss     | sourcer2@ | 7/32020

Jimmy   | Acme4     | Intern   | sourcer2@   | 7/3/2020

 

I am trying to create a flow that will sort all people by the owner and then create an HTML table and send them an email with the people the alias needs to follow up with.

 

For example, 

 

Alias1@ would get an email about Morgan and John & Alias2 would get an email about Sara & Jimmy.

 

I can do this in Python, but unsure how to translate it into a Flow. Here is the Python code:

 

Any help on translating this to a flow? 

 

 

 

## x = the resuts downloaded from the flow
items = x['body']['value']
data = {}
for item in items:
    name = item['FullName']
    title = item['Title']
    sourcer = item['Sourcer']
    if sourcer in data.keys():
        data[sourcer].append({
            'name': name,
            'title' : title,
            'sourcer': sourcer,
        })
    else:
        data[sourcer] = [{
            'name': name,
            'title' : title,
            'sourcer': sourcer,
        }]

 

 

 

The result of the data looks like:

 

 

 

{   'alias1': [   {   'name': 'Morgan',
                      'sourcer': 'alias1',
                      'title': 'Recruiter'},
                  {   'name': 'John Shmoe',
                      'sourcer': 'alias1',
                      'title': 'Engineer'}],
    'alias2': [   {   'name': 'Courtney', 'sourcer': 'alias2', 'title': 'None'},
                  {   'name': 'Morgan ',
                      'sourcer': 'alias2',
                      'title': 'Engineer'}]}

 

 

 

and then to send the emails:

 

 

 

for row in data.keys():
    for record in data[row]:
        ##add item to table
    ##send email 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Re: Using Get items to create multiple arrays

I figured it out. In case anyone is trying to do the same thing:

 

Get Items --> 

Parse JSON --> Initialize Variable of an Array

Add "sourcer" name to the Array using using the Apply to Each Condition Statement

Then Apply to each item in Array

Fetch the data from the List again (redundant, but no workaround) using the "sourcer" name as a filter in the Get Items

Generate HTML Table

Send email

View solution in original post

2 REPLIES 2
Highlighted
Microsoft
Microsoft

Re: Using Get items to create multiple arrays

I figured it out. In case anyone is trying to do the same thing:

 

Get Items --> 

Parse JSON --> Initialize Variable of an Array

Add "sourcer" name to the Array using using the Apply to Each Condition Statement

Then Apply to each item in Array

Fetch the data from the List again (redundant, but no workaround) using the "sourcer" name as a filter in the Get Items

Generate HTML Table

Send email

View solution in original post

Highlighted
Microsoft
Microsoft

Re: Using Get items to create multiple arrays

Hi,

 

Thank you for your follow up! Hopefully this can be helpful for future users who are having issues like this.

 

Regards,

 

Alex

 

-------

 

Community Support Team _ Alex Rezac
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (8,725)