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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Sharepoint Integration...
Power Apps
Answered

Sharepoint Integration list ID formula not returning correct value

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

 

I want to show the ID number of the sharepoint list item on a label in the app.

 

I put this formula in the text property of the label: SharePointIntegration.SelectedListItemID.

 

I've also tried: SharePointIntegration.Selected.ID

 

but it returns a static value "1" which doesn't increment with subsequently created records.

 

What am I doing wrong?

 

Thanks a lot!

 

Regards,

 

Daniel

Categories:
I have the same question (0)
  • Verified answer
    v-yangar-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Could you tell me:

    Whether you want to show the ID in label when you selected a record?

     

    If so, I did a test but unfortunately I did not meet the same situation as yours.

    It works in my side.

    Here is the steps of my test:

    1.Set the text property of label as below:

    v-yangar-msft_0-1612864841257.png

    2.Publish this custom form.

    3.Selected one record and click Edit.

    4.I choose the ID 4, and in the label, it show 4 dynamically.

    v-yangar-msft_1-1612864841263.png

    5.When I add a record and it will show the ID which I selected just now:

    v-yangar-msft_2-1612864841265.png

     

    6.When I selected ID10 record which I created just now, it will show the 10 in the label:

    v-yangar-msft_3-1612864841266.png

     

     

     

     

    If I have any misunderstanding, please correct me.

     

     

    Thanks,

    Arrow

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Arrow,

     

    Thanks for your time and expertise on this.

     

    I want to populate the ID number of the record in a field of a new form. 

     

    So the  list represents a unique "job number" which I want to capture when the new form is submitted using submit form().

     

    I'm combining a prefix from another SP list such as WP-01 or AC-01, etc depending on the context so I use a lookup function with an & and then the SharepointIntegration.SelectedlistID to achieve this effect.

     

    Unfortunately I'm still running into a static value.

     

    I would appreciate your assistance on this.

     

    Regards,

     

    Daniel

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-yangar-msft,

     

    I tried your steps and I got the same result.

     

    However, when I create a new item the SharepointIntegration.SelectedListItemID it uses the previous item number. When I open that item and edit it the number updates to the ID number of that item which is correct.

     

    How do I get it to populate the correct number when the new item is created instead of the previous number?

     

    Regards,

     

    Daniel

     

  • Bochie Profile Picture
    237 on at

    Hi @Anonymous ,

    Not sure if I understand correctly, but I think you were trying to get the ID of an item that has not yet been created in the list? If so, just create a dummy label, then for the default text value of the label, you can use the First function with Sort Descending to get the ID of the last item in the list and store it in a variable. Something like:

    Set(varLastItem,First(Sort(YourList,ID,SortOrder.Descending)))

    Once you have the ID number of the last item, in your dummy label, you can set default text to Value(varLastItem) + 1

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Bochie ,

     

    Yes you are understanding me. It is for a record that has not yet been created. 

     

    I did what you said and there is a blue underline from "first..." until the end of the function.

     

    DanielRK_0-1613337441739.png

     

    Then when I put the Value(varLastItem)+1 into the text box it throws this error:

     

    DanielRK_1-1613337585453.png

     

    If I add ID to it it works but returns the wrong value (Value(varLastItem.ID)+1).

     

    I'm not sure what I'm doing wrong.

     

    Please help me.

     

    Regards, 

     

    Daniel

     

     

     

  • Bochie Profile Picture
    237 on at

    @Anonymous ,

    The blue underline is a delegation warning for the function First(). But since you are already sorting the datasource in descending order (which can be delegated) and you are only looking for one item, you will always get the highest ID (equivalent to last item created in the list). 

    If you do not want the delegation warning, you can opt to put a delegable Filter function first, and then sort the result.  Do a delegable Filter and then First will return the first hit from that result like above, something like this:

    Set(varLastItem,First(Sort(Filter(YourList, Created > Today()),ID,SortOrder.Descending)))


    maybe this will work for the other formula error? 

    Text(Value(varLastItem) + 1)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 610

#2
Haque Profile Picture

Haque 317

#3
WarrenBelz Profile Picture

WarrenBelz 315 Most Valuable Professional

Last 30 days Overall leaderboard