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 / Employee signin/out
Power Apps
Unanswered

Employee signin/out

(1) ShareShare
ReportReport
Posted on by 519
  • have a list called 'StaffWhosin' the 'employee' name is a lookup list from 'StaffNames' i can get a signin date time etc, but the signout againist the name, doesnt work, can you help again.

 

basixally on the sign out , I would like a dropdown which it gets from the ‘staffwhosin’ list of staff that have already signed in - then pick the name from the dropdown on the ‘sign out’ screen , they would then press ‘sign out’ button , function would then find the record in the ‘staffwhosin’ then put a date and time in the ‘sign out’ column next to the name selected from the dropdown.

can anyone help plesse with code 

Categories:
I have the same question (0)
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @AndyPowerAppNew To make this easier you may want to have a Yes/No column in your SharePoint List called SignedIn or something like that.

     

    Dropdown Items

     

    Distinct(Filter(StaffWhosIn,SignedIn = true), EmployeeName)
    //Replace EmployeeName with whatever column(s) is the name of your empoyee

     

    OnSelect of Sign out button

     

    Patch
    (
     StaffWhosIn
     ,Filter(StaffWhosIn, EmployeeName = YourDropdownName.Selected.Result && SignedIn = true)
     ,{
     SignedIn = false, 
     //YourSignOutTimeField=YourSignOutTime...
     //..and so forth
     }
    )

     

     

    In the above solution, I take into account that there may be more than one Record in your StaffWhosIn List, that is actually the same person. I am not sure how you are doing it, but I believe you might be using "StaffWhosIn" to populate who is signing in. While populating this List, it is possible that the same person might appear in this list more than once.  It may not be ideal to do it that way, because it may be better if this StaffWhosIn list only contained the employee name, sign in status, last sign in date/time and last sign out date/time. For a full list of signed in dates and times, I think there should be a separate List being used (if it's even needed) for the full audit log of sign in and out dates/times . The way you have it, it's possible that StaffWhosIn List is being used both to determine the current sign in status and store the full audit log of signed in dates and times, and using the same List for both purposes is something I do not recommend as too ideal - however, if you test it and the solution is somewhat acceptable for you, then you can go it with it for now if you really want. 

     

  • AndyPowerAppNew Profile Picture
    519 on at

    Hi @poweractivate , I’m not sure I understand - here is what I would like to do , 

    Hello, Thank you for the reply, here are are screen shots attached, for the employee signout, its a lookup, so the staff can choose their name, and press 'signout' button, then it will update the record on the SharePoint list with the information in the correct column, so there would be only one entry instead of 2 records which i have at the moment. so for the vististor signout, it would a little different using a text box where they type their name then press signout, then the record would be updated. i would like the single record updated, so i have one record only.

    Thank you so much, is there a way on sign out they can only see their name, or type their name then ‘sign out’ so they cannot sign out another user ?

    Hope it makes sense

  • AndyPowerAppNew Profile Picture
    519 on at

    I have a screenshot of my staff sign app form , the employee name , is taken from ‘staffwhosIn’ list, so only staff that have signed will appear here.

     

    then they type their name, press sign out, this will update column in ‘staffwhosin’ list with signoutDateTime, against the record that is already there, so you can only sign out staff That have signed in to begin with 

    does that make sense ?

  • AndyPowerAppNew Profile Picture
    519 on at

    Just thought if staff wanted to have an option to sign out for lunch , then sign back in, can they do this , I put two extra columns in the ‘staffwhosin’ list called ‘lunchIn’ and the column ‘lunchOut, how would that work ?

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @AndyPowerAppNew 
    You can use User().FullName to get the current name of the user. 

    If you only want to know the last signed in and out time, then using StaffWhosIn should suffice, and making sure there's only one record in there. However, you need to know if they are signed in or not, so a Yes/No column SignedIn may help you here.

     

    You can try something like this OnSelect of the Sign Out button :

     

    With
    (
     {_myRecord:LookUp
     (
     StaffWhosIn
     ,'Employee Name' = User().FullName && SignedIn = true
     )
     }
     ,If
     (
     !IsBlank
     (
     _myRecord
     ,Patch
     (
     StaffWhosIn
     ,{
     ID: _myRecord.ID
     ,SignedIn: false
     ,SignOutTimeDate: Now()
     }
     )
     )
     )
    )

     

    You may need to change your Sign in so it sets SignedIn = true when they sign in, for the above to work.

     

    See if it helps @AndyPowerAppNew 

  • AndyPowerAppNew Profile Picture
    519 on at

    Hi @poweractivate , I will try this code the sign out button instead of what I have there now, will this code update the ‘sign outTimeDate’ column on the same record in the SP list ? So it will only sing out user if the staff name exists in the SP list ? Is that right ?

  • AndyPowerAppNew Profile Picture
    519 on at

    Hi , I already have a column shows the user had singed in , will your code check that column ? Please see attached 

  • AndyPowerAppNew Profile Picture
    519 on at

    Hello @poweractivate , just wondering if there is an update for me please ?

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @AndyPowerAppNew 

     

    So it will only sing out user if the staff name exists in the SP list ? Is that right ?

    Yes my recent formula I gave that has the With function used in it, only signs out that specific person who is signed in, but you should have an additional Yes/No column called SignedIn for it to work. You should require the value, and put the default value to No if prompted on creation of this SharePoint column, to default to them not being signed in.

     

     


    @AndyPowerAppNew wrote:
    • I already have a column shows the user had singed in , will your code check that column ?

     


    No that is the sign out date/time and you also have sign/in date time. Simply checking the presence of these columns is not a good idea. If you want to sign in or out again, how do you know they're signed in or out if they have already signed in and out once before? If you have already signed in and signed out before, you will have a date and time in both columns. Does that mean you're signed in, or signed out? It's ambiguous. So that's why you should have the additional SignedIn column with Yes/No choice to make it very clear.

     

    You should change your Sign in button code to set them as signed in as well by setting the SignedIn to true upon sign in, like this:

     

    With
    (
     {_myRecord:LookUp
     (
     StaffWhosIn
     ,'Employee Name' = User().FullName
     )
     }
     ,If
     (
     !IsBlank
     (
     _myRecord
     ,If
     (
     _myRecord.SignedIn
     ,Notify(_myRecord.'Employee Name' & " is already signed in",Error)
     ,Patch
     (
     StaffWhosIn
     ,{
     ID: _myRecord.ID
     ,SignedIn: true
     ,SignInTimeDate: Now()
     }
     )
     )
     ,Patch
     (
     StaffWhosIn
     ,{
     'Employee Name' = User().FullName
     ,SignedIn: true
     ,SignInTimeDate: Now()
     }
     )
     )
     )
    )

     

    This formula only signs them in, if they are signed out. There is a difference though - if they really don't exist in this list yet, a new record is created for them. If they are already signed in, an error notification is displayed.

     

    Similarly, for the formula I gave, it signs them out only if signed in. If you want to add a notification error if not signed in, do this for sign out:

     

    With
    (
     {_myRecord:LookUp
     (
     StaffWhosIn
     ,'Employee Name' = User().FullName
     )
     }
     ,If
     (
     !IsBlank
     (
     _myRecord
     ,If
     (
     !_myRecord.SignedIn
     ,Notify(_myRecord.'Employee Name' & " is already signed out",Error)
     ,Patch
     (
     StaffWhosIn
     ,{
     ID: _myRecord.ID
     ,SignedIn: false
     ,SignOutTimeDate: Now()
     }
     )
     )
     ,Notify(_myRecord.'Employee Name' & " is signed out because they have never signed in",Error)
     )
     )
    )

     

    See if it helps @AndyPowerAppNew 

  • AndyPowerAppNew Profile Picture
    519 on at

    Hi @poweractivate , I have tried the code, on signin and sigout button, and i cant get it to work, would you be able to assist?

     

    AndyPowerAppNew_0-1671525233443.png

    AndyPowerAppNew_1-1671525910603.png

     

    are we having issues becuse the 'Employee' feild is coming from a lookup on another SP list

     

    The StaffWhosIn list - the 'Employee' this is from a lookup called 'StaffNames' so the staffnames are entered in this list and this is what populates the 'Employee' dropdown on the Staff Sgin Screen.

    Would the code still be okay for the signout botton, run checks etc, then populate the 'SignOut' column in the 'Staffwhosin' SP list?

     

    Please can you guide me to fix, as its quite urgent

     

    Thanks

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard