PowerApps LastSubmit() with Examples - SPGuides (2024)

by Bijay Kumar

In this PowerApps Tutorial, We will see what is LastSubmit() function in PowerApps, Why we will use this function, and how PowerApps LastSubmit() works on the PowerApps screen or app.

Also, We will discuss these below topics those are related to the PowerApps LastSubmit() function:

  • How to use lastsubmit in PowerApps
  • PowerApps lastsubmit.id
  • PowerApps lastsubmit not working
  • PowerApps patch last submit
  • PowerApps edit form lastsubmit
  • PowerApps sharepoint list submit

Table of Contents

PowerApps lastsubmit()

  • Before going to start anything related to the PowerApps LastSubmit function, a question maybe comes to your mind that, Does really the LastSubmit() function helps to display the last record or last item that was submitted to the data source?
  • Coming the answer to this question is, Yes you can use the PowerApps LastSubmit function to retrieve the last item submitted during the current session.
  • The PowerApps LatSubmit() is a property of the Edit Form. It can not communicate with the data source and therefore it is not affected by when multiple users submit nearly simultaneously.
  • There are three below important points I can tell you shortly:
  1. This property applies only to the Edit form control.
  2. If the data source automatically generates or calculates any fields, such as an ID field with a unique number, the LastSubmit property will have this new value after SubmitForm successfully runs.
  3. The value of this property is available in the OnSuccess formula. This confirms the last successfully submitted ID is stored in the Edit Form properties.

You may like, PowerApps First, FirstN, Last, and LastN functions.

How to use lastsubmit in PowerApps

Here, by taking a simple scenario, We will see how to use PowerApps LastSubmit function easily. Refer to these below steps to do so.

Example – 1:

  • The below screenshot represents the SharePoint List named Customer Care Report Details where the submitted records will save.
  • This list has these many columns (with different data types) like Title, Customer Care Report For, Plot Number, and so on.
PowerApps LastSubmit() with Examples - SPGuides (1)
  • The below screenshot represents the PowerApps Edit form that helps to submit a new item or record into that specific SharePoint list.
  • The DataSource of the Edit form is the SharePoint List i.e. Customer Care Report Details.
PowerApps LastSubmit() with Examples - SPGuides (2)
  • Here what I want to do is, I will insert a Label that will help to display the last submitted item in PowerApps.
  • To do so, select the Label control and apply this below formula on its Text property as:
Text = "The last record that you submitted is: " & Form1.LastSubmit.'Customer Name'

Where,

  1. Form1 = PowerApps Edit Form name
  2. Customer Name = This is one of the column names from the specified SharePoint list. This helps to get the last customer name that you have submitted currently
  • Now Save and Preview (F5) the app. Enter the field values and click on the Submit button. When you will click the button, then you can see the last customer name in the label control as shown in the below screenshot.
PowerApps LastSubmit() with Examples - SPGuides (4)
  • Also, you can see the submitted item has been stored in the specified SharePoint list as shown below.
PowerApps LastSubmit() with Examples - SPGuides (5)

Example – 2:

  • In this example, We will see how to retrieve the last submitted item details using the PowerApps LastSubmit function.
  • The Last retrieved item will display on the PowerApps Display Form and the DataSource should be the SharePoint List name.
  • To do this, Insert a PowerApps Display Form and set this below formula on its Item property as:
Item = Form1.LastSubmit

Where,

See also Power Apps Modern Dropdown Control [Complete Tutorial]

Form1 = PowerApps Edit Form name

PowerApps LastSubmit() with Examples - SPGuides (6)
  • Save and Preview (F5) the app. Enter the field values in the edit form and click on the submit button. Once you will click, you can view the last submitted item details in the display form as shown in the below screenshot.
PowerApps LastSubmit() with Examples - SPGuides (7)

This is how to use lastsubmit() in PowerApps.

Also, check out, PowerApps CountRows function.

PowerApps lastsubmit.id

In this topic, We will see how to retrieve the ID of the Last submitted record or item using the PowerApps LastSubmit function.

  • Suppose you want to get the ID of the last submitted form within a new form of your app. Then the Editform.LastSubmit formula would return the last successfully submitted record.
  • You can access this property value within the OnSuccess property of the Edit Form.
  • If you will open a New form within your app, then the Edit form would be reset and at the same time, the Editform.LastSubmit.ID formula would return empty.
  • To do this, Insert a Label control and apply this below formula on its Text property as:
Text = "The last record that you submitted is: " & Form1.LastSubmit.ID

Where,

Form1 = PowerApps Edit Form Name

PowerApps LastSubmit() with Examples - SPGuides (8)
  • Save and Preview (F5) the app. Enter the field values and click on the Submit button. Now you can see the submitted ID will visible in the Label control as shown below.
PowerApps LastSubmit() with Examples - SPGuides (9)
  • Similarly, you can also take a try with the following formula to get the last submitted form data (a record) within your app i.e.: [As I have applied this formula on Label’s Text property]
Text = Last('Customer Care Report Details').ID

Where,

‘Customer Care Report Details’ = SharePoint List name

PowerApps LastSubmit() with Examples - SPGuides (10)

This is how to use PowerApps lastsubmit.id to get the id of the last item.

Read Power Apps List Box Control

PowerApps lastsubmit not working

  • In some cases, While working with the PowerApps LastSubmit function, you may experience that when you are trying to get the ID of the last submitted item (EditForm.LastSubmit.ID), this formula is giving an empty result to you. At the same time, you will think that the PowerApps lastsubmit function is not working properly.
  • To clear this type of issue, follow this simple scenario that why you are getting an empty result and how you can solve this issue by using the PowerApps LastSubmit function. Let’s discuss these below important points.
  • When you want to get the ID of the last submitted form from your app, in that case, you could consider taking 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.
  • Let’s do this example. Select the PowerApps Edit form and apply this below formula on its OnSuccess property as:
OnSuccess = ClearCollect(LastSubmittedItem,Form1.LastSubmit)

Where,

  1. ClearCollect = This is used to clear all the records from the Powerapps Collections and add a new record or collection into it.
  2. LastSubmittedItem = You need to specify a PowerApps Collection name
  3. Form1.LastSubmit = This will help you to retrieve the last submitted item from the edit form.
PowerApps LastSubmit() with Examples - SPGuides (11)
  • Now you need to reference the ID value of the last submitted form within your app using the following formula: (To test this, I have taken a PowerApps Gallery Control and applied the below formula on its Items Property)
Items = LastSubmittedItem.ID

Refer to the below screenshot.

PowerApps LastSubmit() with Examples - SPGuides (12)
  • Save and Preview (F5) the app. Enter the fields in the edit form and click on the Submit button. Once you will submit the item, then the Gallery control will display the last submitted item ID as shown in the below screenshot.
PowerApps LastSubmit() with Examples - SPGuides (13)

PowerApps patch last submit

Here we will see how to work with PowerApps Patch last submit function.

  • In this scenario, I am using a PowerApps Edit form to submit the item to the specific SharePoint list. At the same time, I want to use the patch function to update a field of the last submitted item. Both Submit and Patch functions should be used from the same button only.
  • In this case, most of PowerApps users (new users) are getting confused that: “Is it really possible to use the PowerApps Submit and Patch function from the same button control?”
  • Coming the answer to this question is, Yes, you can perform multiple actions by clicking only one button. To do so, you just need to use a “;” to connect with two formulas. Follow this below example to submit a form and update one field of one item by clicking a button.
  • Select the Submit button from the PowerApps Edit form and apply this below formula on its OnSelect property as:
OnSelect = SubmitForm(Form1);Patch( 'Customer Care Report Details', Form1.LastSubmit, {'Customer Care Report For': "Airtel"})

Where,

  1. Form1 = Edit form name
  2. ‘Customer Care Report Details’ = SharePoint list name
  3. ‘Customer Care Report For’ = This is the SharePoint Column name where I will update the new value of the last submitted item
  4. “Airtel” = This is the string that I have specified to update
  • The above code specifies it will submit the item into the specific SharePoint list and as well as update the field by a given value (“Airtel”) of the last submitted item.
PowerApps LastSubmit() with Examples - SPGuides (14)
  • Now Save and Preview (F5) the app. Enter the record and click on the Submit button. As you can see, I have specified the value as “Vodafone” in the “Customer Care Report For” field.
  • But once you will click on the submit button, the field value will be changed to Airtel (as I have specified in the above formula) in the SharePoint list.
PowerApps LastSubmit() with Examples - SPGuides (15)
  • Go to the SharePoint list i.e. Customer Care Report Details. You can see the new Item has been created and the value has been updated with Airtel as shown in the below screenshot.
PowerApps LastSubmit() with Examples - SPGuides (16)
  • The next time, When you will add a new record, then also, By default the “Customer Care Report For” column value will update with the value of “Airtel“, even if you will not enter this field value for any user.
See also Power Apps Show/Hide Button Based On The Current User

PowerApps sharepoint list submit

In this topic, We will see how to store an item to a SharePoint list using the PowerApps Edit Form and as well as a Submit button control.

  • Suppose your app is having a PowerApps Edit Form and a Submit button. When the user will Enter the field values (in the Edit form) and click on the submit button, then that particular item will save into the specific SharePoint list.
  • To do this, you can apply this below formula on Button’s OnSelect property as:
OnSelect = SubmitForm(EditForm1)

Where,

EditForm1 = PowerApps Edit Form Name

NOTE:

One thing you must remember is, you must need to connect your Data source to the app. As you are saving the item in the SharePoint list, So you need to create a connection, Connect the SharePoint data source and add the specific SharePoint list to your app.
  • Below is the link that describes more details about how you can use PowerApps Edit Form, a Submit button, and how an item can be stored in a SharePoint list.
  • PowerApps submit form to SharePoint Online list

Also, you may like these below PowerApps Tutorials:

  • PowerApps AddColumns Function with Examples
  • PowerApps Patch Function with examples
  • PowerApps ForAll Function with examples
  • PowerApps if statement with examples
  • PowerApps Replace Function with examples
  • PowerApps Employee Directory
  • PowerApps Pen input control (PowerApps signature)
  • PowerApps SharePoint Lookup Column + PowerApps Dropdown Example
  • How to add PowerApps app to Microsoft Teams – Step by Step
  • PowerApps Barcode Scanner – Detailed tutorial
  • PowerApps Examples – COVID 19 Self Declaration form
  • How to build multilingual app in PowerApps
See also How to Set Power Apps Gallery Control Row Color?

In this PowerApps Tutorial, We saw how to use LastSubmit() function in PowerApps. We saw PowerApps lastsubmit() function with a few examples.

Also, We discussed these below topics those are related to the PowerApps LastSubmit function:

  • How to use lastsubmit in PowerApps
  • PowerApps lastsubmit.id
  • PowerApps lastsubmit not working
  • PowerApps patch last submit
  • PowerApps edit form lastsubmit
  • PowerApps sharepoint list submit

PowerApps LastSubmit() with Examples - SPGuides (17)

Bijay Kumar

I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com

PowerApps LastSubmit() with Examples - SPGuides (2024)
Top Articles
Latest Posts
Article information

Author: Rev. Porsche Oberbrunner

Last Updated:

Views: 6411

Rating: 4.2 / 5 (73 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Rev. Porsche Oberbrunner

Birthday: 1994-06-25

Address: Suite 153 582 Lubowitz Walks, Port Alfredoborough, IN 72879-2838

Phone: +128413562823324

Job: IT Strategist

Hobby: Video gaming, Basketball, Web surfing, Book restoration, Jogging, Shooting, Fishing

Introduction: My name is Rev. Porsche Oberbrunner, I am a zany, graceful, talented, witty, determined, shiny, enchanting person who loves writing and wants to share my knowledge and understanding with you.