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

set variable from get items result to avoid apply to each

My flow is creating a Sharepoint item and I have the get items function finding an email to add to a text field in my Sharepoint item. It works beautifully except when I add the field i obtained from "Get Items", an "Apply to Each" is added, which then duplicates my Sharepoint entry. How can I save my get items result as a variable so that I can avoid the "Apply to Each" from being added?

6 REPLIES 6
Dual Super User
Dual Super User

Re: set variable from get items result to avoid apply to each

Hi!

 

The "Get Items" action gets youa list of items and adding anything from this output will be under an apply to each control. Yo need to add a unique identifier to get the particular record: 

1. Create an array variable and iterate through to find the particular record

2. Instead of Get Items, use Get Item with the appropriate identifier. 

 

Hope this helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS! 

v-zhos-msft
Level 10

Re: set variable from get items result to avoid apply to each

Hi @kels89 ,

Could you please share a screenshot of your flow's configuration?

It seems you want to get the data from one list, then create new item in another list.

Could you please provide more details about your scenario?

As @yashag2255  said, if you want to get the specific item data, you can use the 'Get item' action.

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted
kels89
Level: Powered On

Re: set variable from get items result to avoid apply to each

Is there a way to add a filter query to get item? If I can get that to work, then I think it will be doable but I'm not seeing the filter query option.  

kels89
Level: Powered On

Re: set variable from get items result to avoid apply to each

Capture1.JPGCapture2.JPGCapture3.JPG

 

@v-zhos-msft  & @yashag2255  See my flow, above! I have created a request off flow and I am trying to pull two different items from the same list of users: a requestor and a covering provider.  I have Get Items working using a condition for the requestor name. However, I also need to pull in the covering provider that matches the name the user put in the form. This is where I'm getting stuck. I tried Get Items but I need help converting it to a variable so that it doesn't add an apply to each and duplicate the "Create Item". Get Item doesn't allow me to add a filter query.

 

 

 

v-zhos-msft
Level 10

Re: set variable from get items result to avoid apply to each

Hi @kels89 ,

As the pic shown, you used the 'Filter Query' to get the item which  the provider equal to the user put in the form.

Whether the action will return multiple items or just one item.

If the action just returned a specific item, I think you don't need mind the 'Apply to each'.

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

kels89
Level: Powered On

Re: set variable from get items result to avoid apply to each

@v-zhos-msft, The filter query is only returning one item, however, flow is still requiring I add an apply to each when I add that field in my sharepoint list, which then duplicates the entry. That's why I believe I have to convert it to a variable to add it into the Create Sharepoint Item action.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

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 Kudoed Authors (Last 30 Days)
Users online (5,227)