cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
petergriac
Helper II
Helper II

Get the last ID of Sharepoint list item to Powerapps

Hi!

I'm creating a record in PowerApps and saving it to Sharepiont List with Patch() function:

 

Patch(PhoneVacation, Defaults(PhoneVacation),
{Vacation_x0020_Type:Dropdown_Vacation.Selected.Value,Detail: Detail.Text,...

Now I want to get ID of the new item that is created in Sharepoint list and pass it to worflow. 

Does anyone knows how do I get the last item ID from sharepoint list back to PowerApps? 

Thanks a lot

1 ACCEPTED SOLUTION

Accepted Solutions
tchin-nin
Memorable Member
Memorable Member

Then you can try 

Refresh(PhoneVacation);
Set(LastAddedItem,First(Sort(PhoneVacation,ID,SortOrder.Descending)))

 Théo

View solution in original post

6 REPLIES 6
tchin-nin
Memorable Member
Memorable Member

Hi @petergriac

 

If you can consider using a SubmitForm function instead of a Patch, you can use the LastSubmit property of a form. 

 

SubmitForm(EditForm1)

EditForm1.LastSubmit.ID will return the ID of item you've just created. 

 

Théo

Thanks Theo.

Do you know if there is another way? I'm not using forms here.

tchin-nin
Memorable Member
Memorable Member

Then you can try 

Refresh(PhoneVacation);
Set(LastAddedItem,First(Sort(PhoneVacation,ID,SortOrder.Descending)))

 Théo

View solution in original post

Thanks a lot, this works for me

@tchin-nin, how would I alter this code to get it to write to a column in a different sharepoint list?

Hi @tchin-nin 

Thanks, a lot man this really helped me a lot. Kudos to you expert. 

 

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,858)