cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
moc
Level: Powered On

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
Highlighted
CGILL
Level: Powered On

Re: Returning Value from Array using given Key Name

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
Highlighted
CGILL
Level: Powered On

Re: Returning Value from Array using given Key Name

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

moc
Level: Powered On

Re: Returning Value from Array using given Key Name

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
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

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!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (5,190)