cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
moc
Regular Visitor

Returning Value from Array using given Key Name

I am less than a week into using Microsoft Flow, so this is new to me. I've made it pretty far, but I'm stuck on what I think is a pretty common need:

I have an array with key names and values; I want the value for a corresponding known key name.

 

Short-version of what my Flow does: takes in an email notification of a new post from our Forum site, parses the body of the email, and creates a task in a specific bucket in Planner so the post can be assigned to a internal resource to answer it.

 

I have the email coming in using the When a new email arrives trigger, using the Html to text action to format the text. I can extract the forum's name and save it as a string variable called ForumName.

 

Then I call the List buckets action to return a list of all of the task buckets I have on my Planner board. I use the Filter array to filter this down to just the bucket that has the bucket name = ForumName. This all works, so far so good!

 

Now, I've got an array that has the following key-names and values:

  • name of the bucket
  • the planId for the Planner board
  • the orderHint for the sorting order
  • the id for the bucket itself

Here it is in all its glory:

 

 

[
  {
    "@odata.etag": "W/\"abababababababababababbabababa=\"",
    "name": "SuperHeroes",
    "planId": "ab-c1234567890abc12345678",
    "orderHint": "12345678",
    "id": "xyzAbcD3FghiW9145F73ed12VqE3"
  }
]

(the values have been changed but the structure is exactly what I have)

 

 

I need the correct Bucket Id for the Create a task action so I can create the task in the bucket. Thus, I want the id value xyzAbcD3FghiW9145F73ed12VqE3 (in the example above) saved into a string variable BucketID so I can pass it into the Bucket Id in that action:

MS Flow - Create a task for MS Forums Post.png

 

I need the id from my filtered array...but I cannot figure out a way to get to it!

 

I've tried looking at several examples in this forum and closest I've gotten is using a Apply to each loop with a Compose action inside. The Compose action Input = items('Apply_to_each')?['id']. Here is what the test run output looks like:

MS Flow - Apply to each and Compose for MS Forums Post.png

There it is...but now how to I reference this output?

 

I'm done making the bruise on my forehead bigger from hitting it on my desk and have decided to ask the experts.

 

Thank you very much for the assistance!

1 ACCEPTED SOLUTION

Accepted Solutions
CGILL
Frequent Visitor

You should have a "Compose Output" in your dynamic expression for any actions added after the compose step. This will contain the output value from the screenshot you posted.

 

For example, you should see something like this (i used "send me a mobile notification" as an example, you could put whatever the next action you have to perform is). Circled in red is the value you want from the output of your compose action (the id):

Annotation 2019-04-01 162233.png

 

Note, if you're not seeing the compose output, you've either tried to add an action outside of the apply_to_each loop (which won't work because the compose value is specific to the iteration of the loop (even if you only have one iteration)) OR it's hidden under the "see more" link under the Compose action (like below) in which case just click the link and it should show as seen above:

Annotation 2019-04-01 162233.png

View solution in original post

2 REPLIES 2
CGILL
Frequent Visitor

You should have a "Compose Output" in your dynamic expression for any actions added after the compose step. This will contain the output value from the screenshot you posted.

 

For example, you should see something like this (i used "send me a mobile notification" as an example, you could put whatever the next action you have to perform is). Circled in red is the value you want from the output of your compose action (the id):

Annotation 2019-04-01 162233.png

 

Note, if you're not seeing the compose output, you've either tried to add an action outside of the apply_to_each loop (which won't work because the compose value is specific to the iteration of the loop (even if you only have one iteration)) OR it's hidden under the "see more" link under the Compose action (like below) in which case just click the link and it should show as seen above:

Annotation 2019-04-01 162233.png

moc
Regular Visitor

Thanks @CGILL ! Your directive to put the Set Variable inside the loop...of course, makes perfect sense!

 

Thank you also for the your suggestion to click on See more, I would not have thought of that myself. Perfect!

 

I'm all set now!  A big THANK YOU!!!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,564)