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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / retrieve a single list...
Power Automate
Unanswered

retrieve a single list item for SharePoint Get Item

(0) ShareShare
ReportReport
Posted on by

I have a SharePoint list that has a single item (always).  I'm trying to use Get Item to retrieve the value in a single column so I can update a variable.  I don't have the ID of the item.  If this were sql I would do a max() function to get a single value.  I don't know OData filter syntax and can't quite figure it out.

Categories:
I have the same question (0)
  • RezaDorrani Profile Picture
    12,143 on at

    Hi @Anonymous 

     

    Get Item has to have the ID

     

    You next best bet is to use GetItems to get all items

    and then use for loop and get the column info you need

     

     

    Regards,

    Reza Dorrani

     

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

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    If the list never has more than one item then you could just use Get Items and the First() function to address the single record in the list.  Get items doesn't require an ID but will always return a collection of records even if its a collection of one.

  • Community Power Platform Member Profile Picture
    on at

    @Pstork1 Your answer appears to be what I need but I can't figure out how to use it.  Here is my get items, I assume I am using the Filter Query, how do I add the Items collection to first()?

    Untitled.jpg

  • Verified answer
    Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    If your list only contains one item you don't need to do anything particular with Get Items.  YOu just need to use First() whenever you want to access one of the fields in the list that is returned. So I have a list with a single line of text field called Color.  I do a Get Items to get all the items in the list and then when I want to use Color I put that dynamic content call inside First().

    screenshot.png

  • Community Power Platform Member Profile Picture
    on at

    @Pstork1 that was what I needed.  Thank you!  On to the next error...!  Smiley Very Happy

  • Community Power Platform Member Profile Picture
    on at

    @Pstork1 I spoke too soon.  In the Dynamic Content I see the column I need but when I select "First()" then go back to the dynamic content, the column is gone.  Any thoughts?

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    The dynamic content screen filters things and that can sometimes be an issue.  What kind of field are you trying to retrieve?

  • SagarS Profile Picture
    9 on at

    Hello @Pstork1 

     

    When I use first(body('Get_Item')?['Value']) in the expression to initialize a variable, the flow is throwing an error to correct this reference.

     

    SagarS_0-1594719187266.png

    Could you help please? Thank you.

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    When you add the content to the screen before using the first it will add a for each loop.  Hover over the dynamic content at the top of the loop and inside the loop.  Copy down the JSON that is there.  You'll need a combination of that JSON entered manually into the expression tab if the dynamic content filters the value out.  Show me those two JSON strings and I'll help you figure out what the right JSON should be.

  • SagarS Profile Picture
    9 on at

    Oh, that's a nice tip sir. Thank you.

     

    I had renamed 'Get Items' action and was still using Get_Items in the first expression. Your trick gave me the correct JSON name for above action, when I used it, it worked. Thanks again.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard