Hey Everyone,
I'm pretty far down the road with a Flow to query the graph api for user delta changes. I just need to pass the JSON body to a Desktop Flow.
The output after a Parse JSON looks like this:
{
"from": [
{
"jobTitle": "Retail Manager",
"companyName": "Testing",
"department": "Testing",
"userPrincipalName": "AdeleV@y37.onmicrosoft.com",
"country": "United States",
"id": "152a2f01-2de6-4030-8b23-da0fafe2"
},
{
"jobTitle": "Marketing Assistant",
"companyName": "Testing",
"department": "Testing",
"userPrincipalName": "AlexW@y37.onmicrosoft.com",
"country": "United States",
"id": "ec31b4cd-b3b7-4e4b-89a8-c94921d"
},
{
"department": "Testing",
"userPrincipalName": "testadmin@y37.onmicrosoft.com",
"id": "e3fe7172-7c9a-4463-9176-b0006c17b"
},
{
"jobTitle": "HR Manager",
"department": "Testing",
"userPrincipalName": "DiegoS@y37.onmicrosoft.com",
"country": "United States",
"id": "db9b2dd7-7295-409a-a3d9-ade02982"
},
{
"jobTitle": "Designer",
"department": "Testing",
"userPrincipalName": "GradyA@y37.onmicrosoft.com",
"country": "United States",
"id": "20836cc9-3bdf-445a-9d63-ce304b7c"
}
]
}
And the Desktop Flow looks like this:
(the AddToGroup flow is just a test for a PowerShell script)
The mapping of the Desktop flow variables is easy. What I can't figure out is the For Each "user" component. What do I use to group the values by user? The best I've been able to get so far is an ungrouped array of values.
Cheers.
Solved! Go to Solution.
Hi @MallonoX ,
Maybe you could try to write the expressions manually.
Result Screenshot:
Best Regards,
Charlie Choi
Hi @MallonoX ,
Do you want to get an object once by once?
I have made a test for your reference.
Result Screenshot:
If you want to get the value of a field, you can select the corresponding dynamic content.
Result Screenshot:
In addition, I recommend that you hide your private information, such as using fictitious field values.
Best Regards,
Charlie Choi
Hey @v-yujincui-msft
That's awesome! The first example is exactly what I'm after; where each loop contains a "set" of attributes.
What are the expressions you used for 'from' and 'item'? I don't have either in the Dynamic Content list. Although I'm guessing 'from' is the Body of the preceding Parse JSON?
I think whatever the expression is for 'item' is what I've been searching for.
Cheers.
Hi @MallonoX ,
Maybe you could try to write the expressions manually.
Result Screenshot:
Best Regards,
Charlie Choi
Hey @v-yujincui-msft
You're a legend! That didn't work specifically because I realized the example Parse JSON I posted in my initial post was from a different Graph query and the "from" field wasn't there, which is why I didn't see it in the Dynamic Content expressions. But applying the same logic worked a treat. 😁
This is the expression that worked for me:
body('Parse_JSON_-_Users')?['value']
What I've now realized was causing the problem is the "automatic" Dynamic Content expression for "value" is:
body('Parse_JSON_-_Users')?[body]?['value']
For future reference I had to make custom expressions for each of the variables in the desktop flow, e.g.:
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
70 | |
24 | |
18 | |
16 | |
13 |
User | Count |
---|---|
133 | |
43 | |
32 | |
32 | |
28 |