web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

set variable from get items result to avoid apply to each

(0) ShareShare
ReportReport
Posted on by 26

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?

I have the same question (0)
  • yashag2255 Profile Picture
    24,695 Super User 2024 Season 1 on at
    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 Profile Picture
    on at
    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.

  • kels89 Profile Picture
    26 on at
    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 Profile Picture
    26 on at
    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 Profile Picture
    on at
    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 Profile Picture
    26 on at
    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 614 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 401 Moderator

#3
chiaraalina Profile Picture

chiaraalina 282

Last 30 days Overall leaderboard