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 / This is creating a log...
Power Apps
Unanswered

This is creating a log, how do I get it to update instead?

(0) ShareShare
ReportReport
Posted on by 36

When I run the following formula, it creates a log in my sharepoint list of all the interactions with my app:

Patch(EmployeeStatusLog,Defaults(EmployeeStatusLog),{Title:Label7.Text},{SignOut:'SignIn/SignOut'.FalseText},{Comments:TextInput1.Text},{ReturnDateTime:DatePicker1.SelectedDate},{Time:HourDropdown.Selected.Value&MinuteDropdown.Selected.Value},{Reason:Dropdown1.SelectedText});Reset(TextInput1);Reset(DatePicker1);Reset(Dropdown1);Reset(HourDropdown);Reset(MinuteDropdown);Navigate('Complete 1')

 

I want to create a second list 'EmployeeStatusLog2' that keeps the same line for each person and just updates as they interact with the app. 

Can anyone help me?

Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @Alexyoung 

    I dont see an employee name field in your Patch statement.  For simplicity's sake lets use the employee email in this example.  Its a good way to do things because its always unique

    Put this code in the OnStart property of your app

     

    // creates a new record if the employee has not logged into the app before
    If(
     IsBlank(LookUp(EmployeeStatusLog2,Email=User().Email)),
     Patch(EmployeeStatusLog2, Defaults(EmployeeStatusLog2), {Email: User().Email})
    )
    
    // gets the Row ID for the employee
    Set(employeeRowID, LookUp(EmployeeStatusLog2,Email=User().Email, ID))

     

    When you want to update the record patch it like this (I only changed the 2nd argument).

     

    Patch(EmployeeStatusLog, ID=employeeRowID,{Title:Label7.Text},{SignOut:'SignIn/SignOut'.FalseText},{Comments:TextInput1.Text},{ReturnDateTime:DatePicker1.SelectedDate},{Time:HourDropdown.Selected.Value&MinuteDropdown.Selected.Value},{Reason:Dropdown1.SelectedText});Reset(TextInput1);Reset(DatePicker1);Reset(Dropdown1);Reset(HourDropdown);Reset(MinuteDropdown);Navigate('Complete 1')

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Alexyoung Profile Picture
    36 on at

    Thanks for the help! 

     

    There won't be multiple people logging onto the app, it will always be logged into as the same. I use a label on the page to indicate who is signing in and out. 

     

    Is there another way?

  • mdevaney Profile Picture
    29,993 Moderator on at

    @Alexyoung 

    You can still use this code.  It doesn't matter how many people are using the app.  It still works.

     

    Did you try the code yet?

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Alexyoung Profile Picture
    36 on at

    I am trying to use it.

    In the first IF statement the patch isn't working. 

  • mdevaney Profile Picture
    29,993 Moderator on at

    @Alexyoung 

    Any error message?

  • Alexyoung Profile Picture
    36 on at

    Looks like something's not quite right with it

    Capture.PNG
  • mdevaney Profile Picture
    29,993 Moderator on at

    @Alexyoung 

    You'll need to retype that.  Some brackets are in the wrong places or are missing.  Look at my code above.

  • Alexyoung Profile Picture
    36 on at

    Still not working 

    Capture.PNG
  • mdevaney Profile Picture
    29,993 Moderator on at

    @Alexyoung 

    The close bracket ) is missing after EmployeeDataLog2.

     

     

  • Alexyoung Profile Picture
    36 on at

    Still having issues with it, sorry.

    Capture.PNG

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
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard