0

I'm working on a project I need to be able to: Scan through few lists(around 10) based on some criteria and then send a single email with some basic information Title and a link to the item.

My approach was create a separate list to store the list names and URL and then iterate through the list and then append the values to output.

See screenshot below.

The first get items iterate though the list names stored as a list

The second get item gets scan through the list names and output the values

In the compose I can see the values in JSON for each list.

But how do I iterate though it to get the values I need?

I have also tried the below in the Compose 2 (But I manage to get only the first item of each list)

outputs('Get_items_2')?['body']?['value'][0]?['Title']

enter image description here

Thanks in Advance

4
  • You either have to use the 2nd apply to each after Get items 2 to collect items in a variable OR at the start of flow initialize array variable and after Get items 2, use "Append to array variable" action and append outputs('Get_items_2')?['body']?['value'] array to array variable initialized earlier (this way you will have items from all lists in single variable). Let me know if this approach works for you. Mar 31, 2023 at 8:58
  • Hi Ganesh, THanks for the repy but your suggested first option isn't clear, When i use apply to each for Get item 2 what should I be using? Is it also outputs('Get_items_2')?['body']?['value'] ? I used outputs('Get_items_2')?['body']?['value'][0]?['Title'] initially and i can only receive the first item of each list and that is because i'm using [0] index.How do i iterate that collecton
    – naijacoder
    Apr 1, 2023 at 8:20
  • Use outputs('Get_items_2')?['body']?['value'] as input parameter to 2nd apply to each. Add compose action inside this apply to each loop and use expression like this to get Title: item()?['Title']. Apr 1, 2023 at 8:49
  • Check my answer below for complete flow example Apr 1, 2023 at 8:59

1 Answer 1

1

Use flow like this:

enter image description here

Expression used in compose action:

item()?['Title']
2
  • Thanks Ganesh for the prompt response. I ended up doing similar as you suggested by just using item('Apply_to_each_2)?['Title']. The other thing I would like to achieve is I would like my output to be like this as i'm sending it as an email e.g List Name A List of Items A List Name B List of Items B Kind of a grouping. Is this achievable?
    – naijacoder
    Apr 3, 2023 at 0:24
  • It should be. I will suggest you to build a HTML string based on list names & list items. To get ideas, check this and this threads. Apr 3, 2023 at 4:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.