Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Form.LastSubmit function is not working

Posted on by 22
I am trying to use Form.Last Submit functionality but it returns only a blank value. I thought it could problem with the form and tried it a new form and even that does not help either.
 
I tried changing the data sources as well, Form.Last submit is not working, However, already defined Form.Last submit still works. Only the newly defined Form.Last Submit returns blank values. What could be the reason for it?
 
Help me to solve this issue. 
 
Inspection_Overview_form.LastSubmit returns data 
 
 
However, Inspection Form_2. LastSubmit is not returning any data
 
To identify if the problem is related to the form itself or within the app, I tried the following steps 
 
1. I created a new Inspection Form 2 with the same data source and tried the Form.LastSubmit it does not work .
2. I created a new Inspection Overview Form and tried Form.LastSubmit, even there it is not working but as you can see in the screenshot the previously defined Inspection_Overview_form.LastSubmit still works!
3. I tried creating a new app and inserted a new Form and connected to the data source and checked the Form.LastSubmit, the issue still remains the same.  
 
Help me to solve this issue  
 
 
 
 
  • timl Profile Picture
    timl 31,980 on at
    Form.LastSubmit function is not working
    Hi CU25110749-0,
     
    You're welcome! I'm glad this is now working for you.
     
  • CU25110749-0 Profile Picture
    CU25110749-0 22 on at
    Form.LastSubmit function is not working
    Hi timl,
     
    Thanks a lot for your help, it worked. 
    I have been struggling with this issue for a week now and finally resolved.
     
    Thanks 
     
  • Verified answer
    timl Profile Picture
    timl 31,980 on at
    Form.LastSubmit function is not working
    Hi CU25110749-0
     
    I think I found the cause of the problem. I created a test app and form, setup in the same way that you describe. I was able to recreate the problem that you're seeing. 
     
    I was able to solve this problem by going to Settings > Updates and switching off the 'New analysis engine' setting. After re-loading the designer, this solved the problem for me. Hopefully, this will also work for you too.
     
    There have been several reported bugs with the new analysis engine and this appears to be another one of them. Hopefully Microsoft will resolve this soon.  
     
     
  • WarrenBelz Profile Picture
    WarrenBelz 143,487 on at
    Form.LastSubmit function is not working
    Just helping here with a question. What is the Item and DataSource of Form1 ? If the Item is YourGalleryName.Selected what is the Items​​​​​​​ of the Gallery ?
     
  • CU25110749-0 Profile Picture
    CU25110749-0 22 on at
    Form.LastSubmit function is not working
    Hi timl,
     
    I have removed the call to NewForm from OnSuccess screen and as well I have  set the items property of the form to varLastSubmit. 
     
    Once the form is submitted, now the form displays the last submitted record. 
     
     
    So this indicates varLastSubmit holds the record but I am unable to get the column details from that record afterwards. 
    For example varLastSubmit.ID,  varLastSubmit.Title, varLastSubmit.Inspection date is unrecognizable.
     
    Instead If I set a variable to hold the column details itself, (For Eg., Set(var2LastSubmit, Self.LastSubmit.ID); )
    then var2LastSubmit itself becomes unrecognizable. 
     
    Below method is working!!! 
    If I initialize a variable as Set(varLastSubmittedRecord, Last('Firewall Inspection Overview'));then I am able to display the desired values from the record in my Label control using varLastSubmittedRecord.ID or varLastSubmittedRecord.Title
     
    However, it only displays the Last Submitted record from the SharePoint list, what if multiple users are using the application at the same time? it could then go wrong.
     
    Please let me know if you were able to figure out what going wrong here. 
     
    Thanks  
     
     
     
     
     
  • timl Profile Picture
    timl 31,980 on at
    Form.LastSubmit function is not working
    This is strange.
     
    On the basis that the Form1.LastSubmit.ID value flashes up on the label before NewForm resets the Form, this suggests that Form1.LastSubmit is returning the result correctly.
     
    The next thing you can try is to remove the call to NewForm in the OnSuccess property and check that varLastSubmit is set correctly. This would verify if the cause of this is a timing issue - eg, NewForm might be resetting the form before Set is able to store the LastSubmit value.
     
    Following this, I would try monitoring the app to see if there are any errors following the call to SubmitForm.
     
  • CU25110749-0 Profile Picture
    CU25110749-0 22 on at
    Form.LastSubmit function is not working
    Hi timl,
     
    Yes, the save button has only SubmitForm(Form1).
     
  • timl Profile Picture
    timl 31,980 on at
    Form.LastSubmit function is not working
    Just to confirm, have you definitely removed the call to NewForm(Form1) from your Save button? The only call in your Save button would be SubmitForm(Form1). 
  • CU25110749-0 Profile Picture
    CU25110749-0 22 on at
    Form.LastSubmit function is not working
    Updated the OnSuccess property of the form 1 as follows 
     
    Notify("Saved Sucessfully", NotificationType.Success);
    Set(varLastSubmit, Self.LastSubmit);
    NewForm(Form1);
     
     
    After the submission of the form, yes the record still stays empty 
     
     
    Irrespective of using Set(varLastSubmit, Self.LastSubmit); or Set(varLastSubmit, Form1.LastSubmit);
    the record still stays empty but why is it still empty?
     
    Thanks
     
     
  • timl Profile Picture
    timl 31,980 on at
    Form.LastSubmit function is not working
    Hi CU25110749-0
     
    That's very strange. If you view varLastSubmit in the variables section of the designer after you submit a record, what do you see there? Does varLastSubmit and its associated columns/properties appear blank?
     
    I'm not sure this would make a difference but if all else fails, you could try referencing Form1 rather Self in the call that sets the variable. 
     
    Set(varLastSubmit, Form1.LastSubmit);
    NewForm(Form1);
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,487

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,014

Leaderboard