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 / Attendance in the office
Power Apps
Answered

Attendance in the office

(0) ShareShare
ReportReport
Posted on by 87

Hello,

 

I am developing an app that will have two buttons - Check In and Check Out. The data is connected with my sharepoint list called EmployeeOffice.

 

I used the following formulas:

Check in button:

Set(CurrentCheckedInRecord; Patch(EmployeeOffice; Defaults(EmployeeOffice);{Title:"Office";StaffFullName:User().FullName;StaffEmail:User().Email;CheckIn:Now()}));; Navigate(CheckIn;ScreenTransition.Fade)

 

Check Out button:

Refresh(EmployeeOffice);; If(!IsBlank(CurrentCheckedInRecord); Patch(EmployeeOffice;CurrentCheckedInRecord;{CheckOut:Now()}));; Navigate(CheckOut;ScreenTransition.Fade)

 

I would like to add the following functionalities:

- you cannot check in again if you didnt check out (the message that you are already checked in should appear)

- you cannot check out if you didnt check in (the message that your have not checked in should appear)

 

I use FullName of my employees and Email address. Employee will check in and out everyday.

Thank you in advance!

 

Best regards,

Bartek

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @Bartek1 

    My thought is just to make the buttons disabled when they should not be pressed via the DisplayMode property.

     

    Put this code in the DisplayMode property of your CheckIn button

     

    If(
     IsBlank(LookUp(EmployeeOffice, StaffEmail=User().Email And CheckOut=Blank())),
     DisplayMode.Edit,
     DisplayMode.Disabled
    )

     

     

    Then put this code in the DisplayMode property of your CheckOut button.

     

    If(
     !IsBlank(LookUp(EmployeeOffice, StaffEmail=User().Email And CheckOut=Blank())),
     DisplayMode.Edit,
     DisplayMode.Disabled
    )

     

     

    ---
    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."

  • Bartek1 Profile Picture
    87 on at

    @mdevaney 

     

    It does not work, when I insert the formula, it shows a yellow triangle next to both buttons and the message that the expected value is enum. There is also info that the formula may not work with the bigger data in 3 cases.

     

    Maybe there should be something more?

  • mdevaney Profile Picture
    29,991 Moderator on at

    @Bartek1 

    I missed an important chunk of code because I was too focused on writing the logical condition.  Please see my original post for the corrected code.

     

    ---
    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."

  • Bartek1 Profile Picture
    87 on at

    @mdevaney 

     

    Now it shows that there is a wrong number of arguments: Received 3, Expected 1.

     

     

  • mdevaney Profile Picture
    29,991 Moderator on at

    @Bartek1 

    Can you please supply a screenshot of the formula you wrote and the error message along side it?

     

  • Bartek1 Profile Picture
    87 on at

    @mdevaney 

     

    My PowerApp is in Polish so it will be hard to understand, but I am using the same formula as you. In the Formula icon it shows two errors:

    1. Incorrect number of arguments: received: 3, expected 1. 

    Location Button1

    .Displaymode

     

    2. Incorrect number of arguments: received: 1, expected at least 2. 

    Location Button1

    .Displaymode

     

    And then there are three in the warning section regading the number of records.

     

    The app is functioning, but the button has still this yellow triangle.

    Do you know why it might be like this? Maybe something is missing in the lookup or isblank formula?

     

     

  • mdevaney Profile Picture
    29,991 Moderator on at

    @Bartek1 

    I missed some brackets.  Corrected above again.  Sorry, I'm typing mostly from a mobile phone.

     

    You can send screenshots in Polish.   Doesn't matter to me.  I see all type of languages here.  PowerApps is a common language though.

     

    ---
    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."

  • Bartek1 Profile Picture
    87 on at

    @mdevaney 

     

    Now the erros dissapeared but there are still 6 warnings.

     

    Attached my formulas and how it looks. Still got triangles, and now the check in button is all the time in "disabled" mode, as I cannot click it. The sherpoint list is empty. Please ba aware that in my PowerApp comma is ";".

     

    Thank you for your support!!

     

     
     
    Checkout.PNG
    checkin.PNG
  • Verified answer
    mdevaney Profile Picture
    29,991 Moderator on at

    @Bartek1 

    It’s probably a delegation warning.  You can still send me the error message.  I can translate the Polish to English.

     

    My guess is User().Email is causing the delegation problem.  To solve it, put this code in the OnStart property of your app.  Then ‘Run App OnStart’.

     

    Set(varUserEmail, User().Email)

     

    Then replace any references to User().Email in your formulas with varUserEmail instead.

     

    ---
    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."

     

     

  • Bartek1 Profile Picture
    87 on at

    @mdevaney 

     

    Now its all working perfectly!! Thank you very much! 🙂

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 342 Most Valuable Professional

#2
11manish Profile Picture

11manish 234

#3
Valantis Profile Picture

Valantis 187

Last 30 days Overall leaderboard