web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch to the last subm...
Power Apps
Unanswered

Patch to the last submitted editform in sharepoint

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all,

 

I currently have an edit form which allows users to submit details about themselves and the task they are working on which gets sent to a SharePoint list. When a user clicks the start button the start time is recorded and when the stop button is pressed the end time is recorded.

 

I have had to put the SubmitForm on the start button rather than the stop button. This is so a record is always recorded when a task is started. If SubmitForm is on the stop button, the user must click stop to record they worked on a task. And if their computer crashes or they forget to click the stop button, the record won't be recorded. So this was my work around.

 

But. The user might need to add some notes which could take place anytime during the task, so I need the notes field (and also the task time) to be patched to the SharePoint list after the form has been submitted. At the moment I cannot get this to work.

 

My form looks like this: 

freddiejoseph1_0-1610111469540.png

 

OnSelect of start button is: UpdateContext({varStarted: true}); Set(_startTime, Now()); SubmitForm(Form1); Patch(FinanceTimeLog, Form1.LastSubmit, {AgentID: NamePicker.Selected.UserPrincipalName}, {StartTime: _startTime})

 

OnSelect of stop button is: UpdateContext({varStarted: false}); Set(_endTime, Now()); Set(_duration, DateDiff(_startTime, _endTime, Seconds)); Patch(FinanceTimeLog, Form1.LastSubmit, {TaskTime: _duration}, {Notes: DataCardValue4.Text})

 

The section is bold is the part which I think isn't working correctly. That information is not being patched to sharepoint. Any help would be much appreciated.

 

Thanks, Freddie

 

 

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    In general, it is not a good practice to refer to the control in the form to get its value as that may have changed (depending on your form modes) after you SubmitForm.

    Please consider changing your Formula to the following:

        Patch(FinanceTimeLog, Form1.LastSubmit, {TaskTime: _duration}, {Notes: Form1.LastSubmit.Notes})

     

    I hope this is helpful for you.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks Randy. After the start (and stop) button is pressed the form disappears/goes blank. However the patch works if I click the stop button. Is there some way I can stop the form disappearing after the first time it is submitted?

     

    freddiejoseph1_0-1610122051197.png

     

     

    Thanks

     

    Freddie

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    What is the Item property of your form?  It appears that it is Edit mode and there is no record being provided in the Item property.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Randy. Currently the Item property of the form is blank

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Start by changing the Item property to Form1.LastSubmit

    This will keep the last submitted record as the current one for the form.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 177

Last 30 days Overall leaderboard