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 / Making the pop up fals...
Power Apps
Answered

Making the pop up false when hitting the button after it checks in and same for checkout.

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Good Afternoon! Everyone. I have this search bar in my app in powerapps. When I put in a badge number it pulls up a pop up which contains a Check In/Out button. So when I press the button once it checks in the person and change the status column value in my sharepoint list to Checked-in and when pressed again, the button, it Checksout the person and change the status column value in my sharepoint list to Checked-out.
So what I want to achieve is to make the pop-up disappear or turn false, once the button is pressed for the first time (for check in) and then after pulling up the same record through search, Now if I press the button the second time for checking out then person it should make the popup turn false or disappear again. Any help would be appreciated. Thank You.

This is the display:

MOALI_0-1699382408917.png

 

And here is my code:

 

UpdateContext({RecordToUpdate: LookUp(Appointments, Associate.Value = Associate_Number.Text)});
Switch(
RecordToUpdate.Status.Value,
Blank(),
Patch(
Appointments,
RecordToUpdate,
{Status: {Value: "Booked"}}
),
"Booked",
Patch(
Appointments,
RecordToUpdate,
{Status: {Value: "Checked-in"}}
);
Notify("You have Checked-in Successfully", NotificationType.Success, 5000),
"Checked-in",
Patch(
Appointments,
RecordToUpdate,
{Status: {Value: "Checked-out"}}
);
Notify("You have Checked-out Successfully", NotificationType.Success, 5000),
"Checked-out"
);   

Categories:
  • MudassarSZ365 Profile Picture
    591 on at

    Hi @Anonymous 

    Initialize the ShowPopup variable to true when you pull up a record.
    Update the ShowPopup variable to false within the Switch statement after the Patch function for both "Checked-in" and "Checked-out" cases.

     

    // This is when you pull up the record, you might have some button or action to show the popup
    UpdateContext({RecordToUpdate: LookUp(Appointments, Associate.Value = Associate_Number.Text), ShowPopup: true});
    
    // This is the modified code with ShowPopup being set to false after each action
    Switch(
     RecordToUpdate.Status.Value,
     Blank(),
     Patch(
     Appointments,
     RecordToUpdate,
     {Status: {Value: "Booked"}}
     ),
     "Booked",
     Patch(
     Appointments,
     RecordToUpdate,
     {Status: {Value: "Checked-in"}}
     );
     Notify("You have Checked-in Successfully", NotificationType.Success, 5000);
     UpdateContext({ShowPopup: false}), // Dismiss popup after check-in
     "Checked-in",
     Patch(
     Appointments,
     RecordToUpdate,
     {Status: {Value: "Checked-out"}}
     );
     Notify("You have Checked-out Successfully", NotificationType.Success, 5000);
     UpdateContext({ShowPopup: false}) // Dismiss popup after check-out
    );

     

    In Power Apps, the Visible property of the pop-up component should look like this:

     

    ShowPopup

     

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    @Anonymous,

     

    I have added code that sets the pop-up to false in the case of Checked-in or Checked-out. Additionally, I made some adjustments to avoid the need for a local variable to store the LookUp record. The code below expects varShowPopUpCheckInOut to be a global variable.

     

    With(
     //Store record within function variable (avoids need for local var)
     {wLookUp: LookUp(Appointments, Associate.Value = Associate_Number.Text)},
     Switch(
     wLookUp.Status.Value,
     Blank(),
     Patch(
     Appointments,
     wLookUp,
     {Status: {Value: "Booked"}}
     ),
     "Booked",
     Patch(
     Appointments,
     wLookUp,
     {Status: {Value: "Checked-in"}}
     );
     Notify("You have Checked-in Successfully", NotificationType.Success, 5000);
     //Hide pop-up
     Set(varShowPopUpCheckInOut, false),
     "Checked-in",
     Patch(
     Appointments,
     wLookUp,
     {Status: {Value: "Checked-out"}}
     );
     Notify("You have Checked-out Successfully", NotificationType.Success, 5000);
     //Hide pop-up
     Set(varShowPopUpCheckInOut, false)
     )
    )

     

    Should you want to hide the pop-up in all cases (also Booked) then you could just write the Set() code after the With statement. With(...); Set()

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    There is no error in the code but because of the modified code I am unable to pull up the record(popup) using the search button. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @LaurensM Hey! man. I have two more columns in my share point list, Check-in time and Checkout time. Is it possible to update/Patch the current time and day along with the same logic like when checking in, patch the current time and date (whatever the time will be at time of check in) and similarly when checking out patch the current time and date (whatever the time will be at time of check out)? 

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 352 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 323

#3
Mohsin Ali Profile Picture

Mohsin Ali 226

Last 30 days Overall leaderboard