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

Notifications

Announcements

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:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 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,989 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,989 Moderator on at

    @Alexyoung 

    Any error message?

  • Alexyoung Profile Picture
    36 on at

    Looks like something's not quite right with it

  • mdevaney Profile Picture
    29,989 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 

  • mdevaney Profile Picture
    29,989 Moderator on at

    @Alexyoung 

    The close bracket ) is missing after EmployeeDataLog2.

     

     

  • Alexyoung Profile Picture
    36 on at

    Still having issues with it, sorry.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard