cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Community Support
Community Support

Re: Form Last Submit ID is empty

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
Highlighted
Community Support
Community Support

Re: Form Last Submit ID is empty

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

Highlighted
Helper II
Helper II

Re: Form Last Submit ID is empty

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.

 

Highlighted
Resolver I
Resolver I

Re: Form Last Submit ID is empty

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.....

Highlighted
New Member

Re: Form Last Submit ID is empty

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

Highlighted
New Member

Re: Form Last Submit ID is empty

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. 

Highlighted
New Member

Re: Form Last Submit ID is empty

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

Highlighted
New Member

Re: Form Last Submit ID is empty

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

Highlighted
Impactful Individual
Impactful Individual

Re: Form Last Submit ID is empty

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. 

Highlighted
Post Partisan
Post Partisan

Re: Form Last Submit ID is empty

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
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,243)