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

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
Super User
Super User

Re: Get the last ID of Sharepoint list item to Powerapps

Then you can try 

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

 Théo

View solution in original post

5 REPLIES 5
Highlighted
Super User
Super User

Re: Get the last ID of Sharepoint list item to Powerapps

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

petergriac
Level: Powered On

Re: Get the last ID of Sharepoint list item to Powerapps

Thanks Theo.

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

Super User
Super User

Re: Get the last ID of Sharepoint list item to Powerapps

Then you can try 

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

 Théo

View solution in original post

petergriac
Level: Powered On

Re: Get the last ID of Sharepoint list item to Powerapps

Thanks a lot, this works for me

SilentStorm
Level: Power Up

Re: Get the last ID of Sharepoint list item to Powerapps

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

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,877)