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

Form Last Submit ID is empty

i have a New Form of SharePoint list in power apps, when i am trying to get the ID of list item in success of Form as below.

NewScreenForm.LastSubmit.ID

but the above formula is giving empty result.

 

could you please help me on this.

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @satya,

 

Could you please share a bit more about your scenario?

Further, do you want to get the ID of the last submitted form within a New form of your app?

 

If you want to get the ID of the last submitted form within a New form of your app, I think you have some misunderstanding on the LastSubmit property of the Edit form.

 

The Editform.LastSubmit formula would return the last successfully submitted record, you could access this property value within the OnSuccess property of the Edit form. If you open a New form within your app, the Edit form would be reset, so the Editform.LastSubmit.ID formula would return empty.

 

If you want to get the ID of the last submitted form within a New form of your app, you could consider take a try to store the last submitted form as a collection within your app, and then you could reference the Editform.LastSubmit property value through the collection.

 

I have made a test on my side, please take a try with the follownig workaround:

 

  • Add the following formula within the OnSuccess property of the Edit form control:
ClearCollect(LastSubmittedRecord,EditForm1.LastSubmit)

then you could reference the ID value of the last submitted form within your app using the following formula:

LastSubmittedRecord.ID

Note: If you firstly open your app, and have not submitted a form within your app, the LastSubmittedRecord collection is empty.

 

In addition, you could also take a try with the following formula to get the last submitted form data (record) within your app:

Last('20180904_case2')

Note: The '20180904_case2' represents the SP list within my app.

 

On your side, you should type the following formula:

Last('YourSPList')

If you want to refernece the ID value of the last submitted form data, please type the following formula:

Last('YourSPList').ID

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
v-xida-msft
Community Support
Community Support

Hi @satya,

 

Could you please share a bit more about your scenario?

Further, do you want to get the ID of the last submitted form within a New form of your app?

 

If you want to get the ID of the last submitted form within a New form of your app, I think you have some misunderstanding on the LastSubmit property of the Edit form.

 

The Editform.LastSubmit formula would return the last successfully submitted record, you could access this property value within the OnSuccess property of the Edit form. If you open a New form within your app, the Edit form would be reset, so the Editform.LastSubmit.ID formula would return empty.

 

If you want to get the ID of the last submitted form within a New form of your app, you could consider take a try to store the last submitted form as a collection within your app, and then you could reference the Editform.LastSubmit property value through the collection.

 

I have made a test on my side, please take a try with the follownig workaround:

 

  • Add the following formula within the OnSuccess property of the Edit form control:
ClearCollect(LastSubmittedRecord,EditForm1.LastSubmit)

then you could reference the ID value of the last submitted form within your app using the following formula:

LastSubmittedRecord.ID

Note: If you firstly open your app, and have not submitted a form within your app, the LastSubmittedRecord collection is empty.

 

In addition, you could also take a try with the following formula to get the last submitted form data (record) within your app:

Last('20180904_case2')

Note: The '20180904_case2' represents the SP list within my app.

 

On your side, you should type the following formula:

Last('YourSPList')

If you want to refernece the ID value of the last submitted form data, please type the following formula:

Last('YourSPList').ID

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

hi, 

New Form on sucess event i am using the formula as below

ClearCollect(OpenApplicationsID,OpenApplicationsNewScreenForm.LastSubmit.ID)

an empty record is storing in the collections. and Last('Listname').ID is also not givingn last item id of list . it is giving the item id of some other item like if i have 1700 records, i deleted some records so due to this the last item id 6789 but  Last('Listname').ID is giving 5766.

 

Anonymous
Not applicable

How do you get the data to show up if the data column in the sharepoint list is considered a 'table' by powerapps. The text columns i have work fine when i use the suggested formula for 'text' columns in the SP, but don't seem to work for 'tables'.  Any thoughts would be awesome.....

You can always find the last ID like this too.
First(Sort(YourSourceName,ID,Descending)).ID

This could be problematic in a multi user environment as it may be the last record in the dataset, but not the last record the user created. 

To pull a single record out of a table use First(colTable)

 

You can also get individual column data in the record like this First(colTable).columnane

So I would do you onsucess event like this. 

 

  • UpdateContext({varID:form.LastSubmit.ID}); // Set the LastSubmit ID to a Variable

Create a button to copy the last record, the onselect would look something like this:

  • ClearCollect(colCopyRecord,(First(Filter(Dataset, ID = varID)));  //Query the Dataset by the ID stored in the variable. Filter will return a table so wrap First() around the Filter to only store a single record in the collection. 
  • UpdateContext({varDuplicateRecord:true});  //Set a variable to let you control the form defaults. ie 

     In your form control in the default/defaults field add some logic like this:

If(varDuplicateRecord,colCopyRecord.ID,Parent.Default) //This line will use the value of ID inside the collection only if the variable varDuplicateRecord = True, if Fasle then use the Data in the Dataset

cwebb365
Power Participant
Power Participant

This was bugging me for the longest time, but for anyone else still looking at this, you can utilize lastsubmit fine for on click events after submitting the forms. The trick is, the OnSuccess of the SharePointForm1 has a resetform(self) built into it. Soon as you submit the record, the form resets, thus wiping out the "LastSubmit" data. Removing this from OnSuccess allows it to stay in the session to reference. Not sure why it resets, I haven't found any negative impacts but this does allow the use of LastSubmit. 

 

Anyway, hope this helps some others. 

Hi @v-xida-msft  

 

I have the same related issue can you please help on this as well if you can thanks sir 

 

Please see the link below 

 

 

https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-Increase-value-by-1-number-ignore-if-... 

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,979)