cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AndyPowerAppNew
Post Prodigy
Post Prodigy

Employee signin/out

  • 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 

53 REPLIES 53
AndyPowerAppNew
Post Prodigy
Post Prodigy

 @poweractivate, what do i replace Title= the name from sharepoint list (StaffWhosIn) where do i store the email address for users, i stillcant get it working , and i also need staff out function too.

what am not doing here?

 

AndyPowerAppNew
Post Prodigy
Post Prodigy

@poweractivate, this is what my feilds look like in my SP list?

 

AndyPowerAppNew_0-1671540456409.png

 

So the code should work? what feilds do my form need to have on the form ?

 

Thanks

poweractivate
Most Valuable Professional
Most Valuable Professional

@AndyPowerAppNew 

 

 

//OnVisible SigninScreen
Set(var_myEmpName,User().Email);

//OnSelect Sign In Button
With
(
	 {_myRecord:LookUp(StaffWhosIn,Title=var_myEmpName)
	,If
	 (
	 	!IsBlank(_myRecord)
	 	,If
	 	(
	 		_myRecord.SignedIn
	 	   ,Notify(_myRecord.Name & " is already signed in - they must sign out first",Error);
	 		Navigate(SignOutScreen)
	 	   ,Patch //change the existing record to signed in
	 	   (
	 		  StaffWhosIn
	 		 ,{
	 			  ID: _myRecord.ID
	 			 ,SignedIn: true
	 			 ,SignInTimeDate: Now()
	 		  }
	 	   );Notify(var_myEmpName & " has signed in!",Success);Navigate(SignOutScreen)
	 	)
	 	,Patch //create new record if not existing yet and set it to signed in
	 	 (
	 		StaffWhosIn
	 	   ,{
	 			Name=var_myEmpName
	 		   ,SignedIn: true
	 		   ,SignInTimeDate: Now()
	 		}
	 	 );Notify(var_myEmpName & " has signed in for the first time!",Success);Navigate(SignOutScreen)
	 )
)
	 
//OnSelect Sign Out Button
With
(
	 {_myRecord:LookUp(StaffWhosIn,Title=var_myEmpName)
	,If
	(
		!IsBlank(_myRecord)
		,If
		(
		   !_myRecord.SignedIn
		   ,Notify(_myRecord.Name & " is already signed out - they must sign in first",Error);
			Navigate(SignInScreen)
		   ,Patch //change the existing record to not signed in
		   (
			  StaffWhosIn 
			 ,{
				  ID: _myRecord.ID
				 ,SignedIn: false
				 ,SignOutTimeDate: Now()
			  }
		   );Notify(var_myEmpName & " has signed out!",Success);Navigate(SignInScreen)
		)
		,Notify(var_myEmpName & " does not exist in the table / is not signed in",Error);
		 Navigate(SignInScreen)
		
	)
)
	 

 

The formulas above may need to be adjusted.

It is also possible to make improvements on the above.

I'm not available for the moment any further @AndyPowerAppNew , if any one wants such as @iAm_ManCat @BCBuizer @WarrenBelz or any one else they could continue it, but in case you still have any issue @AndyPowerAppNew you should figure it out for yourself, or maybe someone else could help you if they are available.

AndyPowerAppNew
Post Prodigy
Post Prodigy

Hi @poweractivate , this is what sign in form looks  like i have added code on onsubmit button, it errors

 

AndyPowerAppNew_0-1671540797992.png

 

poweractivate
Most Valuable Professional
Most Valuable Professional

@AndyPowerAppNew Check if formulas I gave in my most recent response work.

You don't need anything on the form at all other than the Sign in button.

You don't even need a form actually, since these formulas are using Patch.

 

Since the formulas are using Patch the Remote Working control doesn't have to be in a Form.

 

If you want to use your Remote Working control you need to reference it in the Patch formulas for Sign In, such as YourAppropriateColumn:YourControlName.YourAppropriateProperty

but focus first just on getting it to work without this control, then you can try adding it in after you got it to work without it first and just with the Sign in button and sign out buttons by themselves.

 

I changed the formulas again now in my recent post but that is all, and you should try to adjust the formulas so they work for you. You can check the notifications and check the SharePoint List to see if it is working or not.

 

You'll need to figure it out from here how to do it yourself now @AndyPowerAppNew or maybe someone else could help you if they are available and willing to do it.

AndyPowerAppNew
Post Prodigy
Post Prodigy

Hi @poweractivate , one quick question, if we also have a signin button on the form, so are different meant to signin how will the system know this , and feed back to SP list - is there anyone else you know how can help ?

AndyPowerAppNew
Post Prodigy
Post Prodigy

Hello, wonder if anyone can help again, i have made an sign-in/out staff/employee app, but i can the signout to work, this would be the signout screen,

AndyPowerAppNew_0-1671616093598.png

The dropdown list above would be populated from the sharepoint list when users have signed in, they selecte their name from the dropdown press the button, it then fills in the date/time in the empy column again their name that is already in the list (because they signed in)

This is my SP list.

AndyPowerAppNew_1-1671616317348.png

 

so, it would keep the record above, but just update the 'SignOutTimeDate' column, when user clicks button on form.

AndyPowerAppNew
Post Prodigy
Post Prodigy

update; i have tried this

 

AndyPowerAppNew_2-1671617740031.png

Where am i going wrong?

Thanks

AndyPowerAppNew
Post Prodigy
Post Prodigy

Hello,

 

Has anyone got any ideas please - im really stuck

poweractivate
Most Valuable Professional
Most Valuable Professional

@AndyPowerAppNew 

 

I try once more to help you, I just built out the whole app myself and it works for your scenario on my side.

I have a sign in and out functionality which also knows if the person is currently signed in or out, and it works properly when multiple people are using the app at the same time.

 

I corrected any imperfection in the previous formulas for you, so please follow the below including the screenshots, step by step, and it should work for you.

 

These are steps to build everything from the List to the whole app.

These steps are different from what I gave before and the formulas are different,

so be sure to follow each step carefully below.

 

1. Here is how your SharePoint List should look and it should be called MyStaffList.

Go ahead and see the next steps to check the setting for each column.

Step1.png

 

Title should just be left alone and it should still be called Title for now.

2. Here are the settings for the other columns

2a. SignInDateTime

 Site2.png

 

2b. SignOutDateTime

Site3.png

 

2c. SignedIn

Site1.png

Make sure the Default value is set to No for the SignedIn column just like in the above screenshot.

 

Now to build the app:

 

3. After doing both steps above you have built out the SharePoint List MyStaffList 

Add this SharePoint List MyStaffList  as data source to a brand new canvas app

 

When you are done adding the data source it should look like this:

poweractivate_0-1671661081646.png

 

For the next steps from this point, just ignore any errors (if any even appear at all), and do all of the steps all the way through, and there should be no more errors by the time you are done with all the steps below.

 

4. Now add a few Screens - rename the first one SignInScreen and the next one MainScreen - and the third one BlankScreen

 

4b. OnVisible of SignInScreen use this formula

 

Set(var_myEmpName,User().Email)

 

Step2.png

4c. For best results, now click on BlankScreen from the left side (tree view) and then click on SignInScreen again. This initializes the variable, so you may see results more quickly in the next steps even as you are doing the steps.

 

5. Now add a Label control and call it SigninStatusLabel1.

For the Text property put this formula:

 

"Signed In: " & With({_myRecord:LookUp(MyStaffList,Title=var_myEmpName)},If(IsBlank(_myRecord),false,_myRecord.SignedIn))

 

Step3.png

6. Add another Label Control. Below it's called Label2. I've left the name of the Control alone this time. You can rename it if you want to.

For the text Property of that Label put

 

var_myEmpName

 

Step4.png

7. Add a Button. Below it's called Button1. I've left the name of the Control alone this time. You can rename it if you want to.

For the OnSelect of that Button use this formula:

 

With
(
	 {_myRecord:LookUp(MyStaffList,Title=var_myEmpName)}
	,If
	 (
	 	!IsBlank(_myRecord)
	 	,If
	 	(
	 		_myRecord.SignedIn
	 	   ,Notify(_myRecord.Name & " is already signed in - they must sign out first",Error);
	 		Navigate(MainScreen)
	 	   ,Patch //change the existing record to signed in
	 	   (
	 		  MyStaffList
	 		 ,{
	 			  ID: _myRecord.ID
	 			 ,SignedIn: true
	 			 ,SignInDateTime: Now()
	 		  }
	 	   );Notify(var_myEmpName & " has signed in!",Success);Navigate(MainScreen)
	 	)
	 	,Patch //create new record if not existing yet and set it to signed in
	 	 (
	 		MyStaffList
	 	   ,{
	 			Title:var_myEmpName
	 		   ,SignedIn: true
	 		   ,SignInDateTime: Now()
	 		}
	 	 );Notify(var_myEmpName & " has signed in for the first time!",Success);Navigate(MainScreen)
	 )
)
	 

 

Step5.png

7b. For the Text property of that Button put

 

"Sign In"

 

poweractivate_1-1671661677881.png

8. Now go to MainScreen

Add a Label Control. I have left the name as the default, you can rename it if you want to.

For the Text property put:

 

var_myEmpName

 

Step6.png

9. Now add a Label control and call it SigninStatusLabel2.

For the Text property put this formula:

 

"Signed In: " & With({_myRecord:LookUp(MyStaffList,Title=var_myEmpName)},If(IsBlank(_myRecord),false,_myRecord.SignedIn))

 

Step7.png

10. Now add a Button control 

For the OnSelect property put this formula:

 

With
(
	 {_myRecord:LookUp(MyStaffList,Title=var_myEmpName)}
	,If
	(
		!IsBlank(_myRecord)
		,If
		(
		   !_myRecord.SignedIn
		   ,Notify(_myRecord.Name & " is already signed out - they must sign in first",Error);
			Navigate(SignInScreen)
		   ,Patch //change the existing record to not signed in
		   (
			  MyStaffList
			 ,{
				  ID: _myRecord.ID
				 ,SignedIn: false
				 ,SignOutDateTime: Now()
			  }
		   );Notify(var_myEmpName & " has signed out!",Success);Navigate(SignInScreen)
		)
		,Notify(var_myEmpName & " does not exist in the table / is not signed in",Error);
		 Navigate(SignInScreen)
		
	)
)

 

Step8.png

 10b.  For the Text property of that Button put

 

"Sign Out"

 

poweractivate_2-1671661767336.png

11. Now try the app. If not sure how to try it, check Step 12 below.

The app should know if they are currently signed in or not.

Even if you test the app starting with the MainScreen instead of starting with the SignInScreen it should still work correctly and it knows if they are not signed in, and takes them to the Sign In page, giving a message that they were not yet signed in.

 

Same is true vice versa - if they are already Signed In, and you intentionally start the app while on the SignInScreen and press Sign In, it should not sign them in again, it should take them to the MainScreen instead, giving a message that they were already signed in.

 

If you want step by step on how to try it, see the next step.

 

12. Preview the App (or you can ALT+CLICK if you want to test directly in the Editor)

12a. Click on Sign In.
After you see the green message saying they successfully signed in, go to your SharePoint List and manually check the entry. You should see it as correct - the Sign In Date Time

 

12b. Click on Sign Out
After you see the green message saying they successfully signed out, go to your SharePoint List and manually check the entry. You should see it as correct - the Sign Out Date Time

 

13. Repeat Steps 12a and 12b  above again.

Notice it's working and it updates the Sign In Date Time, Sign Out Date Time and Sign In Status accordingly to the correct record in the SharePoint List every time.

 

If you use multiple different users at the same time on this app, it should work correctly for all of them.

 

14. If you like this solution, go ahead and add in your other columns you had before into this same SharePoint List MyStaffList

 

See if it helps @AndyPowerAppNew 

 

P.S.:

 

@AndyPowerAppNew 

 

have attached a working sample msapp file SignInOutApp_1.msapp of the full app built out with all formulas. 

if you would like to import a full, working example yourself for your convenience.

 

To use the sample msapp attached, follow these steps:

 

1) Download the msapp file attached to this post (it's at the bottom of this post), to Desktop or a folder of your choice, by clicking on it from this post.

 

2) Create a new, blank Power App Canvas App

 

3) Click on the three dotsellipses (just to the right of Settings)-> then from the menu that appears, click Open

poweractivate_0-1667393291182.png

 

4) Click Browse

poweractivate_1-1667393328619.png

5 ) Navigate to location of .msapp file from Step 1, select it, and press the "Open" button.

6 ) The working example msapp file should load

 

7) There will be errors showing up. So now you need to add the data source MyStaffList.

Follow the instructions at the top of this post to build out the SharePoint List from scratch.

 

See if this helps as well @AndyPowerAppNew 

 

 

Helpful resources

Announcements

Take a short Community User Survey | Help us make your experience better!

To ensure that we are providing the best possible experience for Community members, we want to hear from you!    We value your feedback! As part of our commitment to enhancing your experience, we invite you to participate in a brief 15-question survey. Your insights will help us improve our services and better serve the community.   👉 Community User Survey    Thank you for being an essential part of our community!    Power Platform Engagement Team  

Tuesday Tip | How to Get Community Support

It's time for another Tuesday Tip, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.       This Week: All About Community Support Whether you're a seasoned community veteran or just getting started, you may need a bit of help from time to time! If you need to share feedback with the Community Engagement team about the community or are looking for ways we can assist you with user groups, events, or something else, Community Support is the place to start.   Community Support is part of every one of our communities, accessible to all our community members.   Within each community's Community Support page, you'll find three distinct areas, each with a different focus to help you when you need support from us most. Power Apps: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pa_community_support Power Automate: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpa_community_support Power Pages: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpp_community_support Copilot Studio: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pva_community-support   Community Support Form If you need more assistance, you can reach out to the Community Team via the Community support form. Choose the type of support you require and fill in the form accordingly. We will respond to you promptly.    Thank you for being an active part of our community. Your contributions make a difference!   Best Regards, The Community Management Team

Community Roundup: A Look Back at Our Last 10 Tuesday Tips

As we continue to grow and learn together, it's important to reflect on the valuable insights we've shared. For today's #TuesdayTip, we're excited to take a moment to look back at the last 10 tips we've shared in case you missed any or want to revisit them. Thanks for your incredible support for this series--we're so glad it was able to help so many of you navigate your community experience!   Getting Started in the Community An overview of everything you need to know about navigating the community on one page!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Ranks and YOU Have you ever wondered how your fellow community members ascend the ranks within our community? We explain everything about ranks and how to achieve points so you can climb up in the rankings! Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Powering Up Your Community Profile Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile. Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Blogs--A Great Place to Start There's so much you'll discover in the Community Blogs, and we hope you'll check them out today!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Unlocking Community Achievements and Earning Badges Across the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. Check out some details on Community badges--and find out more in the detailed link at the end of the article! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Blogging in the Community Interested in blogging? Everything you need to know on writing blogs in our four communities! Get started blogging across the Power Platform communities today! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Subscriptions & Notifications We don't want you to miss a thing in the community! Read all about how to subscribe to sections of our forums and how to setup your notifications! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Getting Started with Private Messages & Macros Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Community User Groups Learn everything about being part of, starting, or leading a User Group in the Power Platform Community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Update Your Community Profile Today! Keep your community profile up to date which is essential for staying connected and engaged with the community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Thank you for being an integral part of our journey.   Here's to many more Tuesday Tips as we pave the way for a brighter, more connected future! As always, watch the News & Announcements for the next set of tips, coming soon!

Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!

April 2024 Community Newsletter

We're pleased to share the April Community Newsletter, where we highlight the latest news, product releases, upcoming events, and the amazing work of our outstanding Community members.   If you're new to the Community, please make sure to follow the latest News & Announcements and check out the Community on LinkedIn as well! It's the best way to stay up-to-date with all the news from across Microsoft Power Platform and beyond.    COMMUNITY HIGHLIGHTS   Check out the most active community members of the last month! These hardworking members are posting regularly, answering questions, kudos, and providing top solutions in their communities. We are so thankful for each of you--keep up the great work! If you hope to see your name here next month, follow these awesome community members to see what they do!   Power AppsPower AutomateCopilot StudioPower PagesWarrenBelzDeenujialexander2523ragavanrajanLaurensMManishSolankiMattJimisonLucas001AmikcapuanodanilostephenrobertOliverRodriguestimlAndrewJManikandanSFubarmmbr1606VishnuReddy1997theMacResolutionsVishalJhaveriVictorIvanidzejsrandhawahagrua33ikExpiscornovusFGuerrero1PowerAddictgulshankhuranaANBExpiscornovusprathyooSpongYeNived_Nambiardeeksha15795apangelesGochixgrantjenkinsvasu24Mfon   LATEST NEWS Business Applications Launch Event - On Demand In case you missed the Business Applications Launch Event, you can now catch up on all the announcements and watch the entire event on-demand inside Charles Lamanna's latest cloud blog.   This is your one stop shop for all the latest Copilot features across Power Platform and #Dynamics365, including first-hand looks at how companies such as Lenovo, Sonepar, Ford Motor Company, Omnicom and more are using these new capabilities in transformative ways. Click the image below to watch today!     Power Platform Community Conference 2024 is here! It's time to look forward to the next installment of the Power Platform Community Conference, which takes place this year on 18-20th September 2024 at the MGM Grand in Las Vegas!   Come and be inspired by Microsoft senior thought leaders and the engineers behind the #PowerPlatform, with Charles Lamanna, Sangya Singh, Ryan Cunningham, Kim Manis, Nirav Shah, Omar Aftab and Leon Welicki already confirmed to speak. You'll also be able to learn from industry experts and Microsoft MVPs who are dedicated to bridging the gap between humanity and technology. These include the likes of Lisa Crosbie, Victor Dantas, Kristine Kolodziejski, David Yack, Daniel Christian, Miguel Félix, and Mats Necker, with many more to be announced over the coming weeks.   Click here to watch our brand-new sizzle reel for #PPCC24 or click the image below to find out more about registration. See you in Vegas!     Power Up Program Announces New Video-Based Learning Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram. These include a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the image below to find out more!     UPCOMING EVENTS Microsoft Build - Seattle and Online - 21-23rd May 2024 Taking place on 21-23rd May 2024 both online and in Seattle, this is the perfect event to learn more about low code development, creating copilots, cloud platforms, and so much more to help you unleash the power of AI.   There's a serious wealth of talent speaking across the three days, including the likes of Satya Nadella, Amanda K. Silver, Scott Guthrie, Sarah Bird, Charles Lamanna, Miti J., Kevin Scott, Asha Sharma, Rajesh Jha, Arun Ulag, Clay Wesener, and many more.   And don't worry if you can't make it to Seattle, the event will be online and totally free to join. Click the image below to register for #MSBuild today!     European Collab Summit - Germany - 14-16th May 2024 The clock is counting down to the amazing European Collaboration Summit, which takes place in Germany May 14-16, 2024. #CollabSummit2024 is designed to provide cutting-edge insights and best practices into Power Platform, Microsoft 365, Teams, Viva, and so much more. There's a whole host of experts speakers across the three-day event, including the likes of Vesa Juvonen, Laurie Pottmeyer, Dan Holme, Mark Kashman, Dona Sarkar, Gavin Barron, Emily Mancini, Martina Grom, Ahmad Najjar, Liz Sundet, Nikki Chapple, Sara Fennah, Seb Matthews, Tobias Martin, Zoe Wilson, Fabian Williams, and many more.   Click the image below to find out more about #ECS2024 and register today!   Microsoft 365 & Power Platform Conference - Seattle - 3-7th June If you're looking to turbo boost your Power Platform skills this year, why not take a look at everything TechCon365 has to offer at the Seattle Convention Center on June 3-7, 2024.   This amazing 3-day conference (with 2 optional days of workshops) offers over 130 sessions across multiple tracks, alongside 25 workshops presented by Power Platform, Microsoft 365, Microsoft Teams, Viva, Azure, Copilot and AI experts. There's a great array of speakers, including the likes of Nirav Shah, Naomi Moneypenny, Jason Himmelstein, Heather Cook, Karuana Gatimu, Mark Kashman, Michelle Gilbert, Taiki Y., Kristi K., Nate Chamberlain, Julie Koesmarno, Daniel Glenn, Sarah Haase, Marc Windle, Amit Vasu, Joanne C Klein, Agnes Molnar, and many more.   Click the image below for more #Techcon365 intel and register today!   For more events, click the image below to visit the Microsoft Community Days website.    

Tuesday Tip | Update Your Community Profile Today!

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   We're excited to announce that updating your community profile has never been easier! Keeping your profile up to date is essential for staying connected and engaged with the community.   Check out the following Support Articles with these topics: Accessing Your Community ProfileRetrieving Your Profile URLUpdating Your Community Profile Time ZoneChanging Your Community Profile Picture (Avatar)Setting Your Date Display Preferences Click on your community link for more information: Power Apps, Power Automate, Power Pages, Copilot Studio   Thank you for being an active part of our community. Your contributions make a difference! Best Regards, The Community Management Team

Top Solution Authors
Top Kudoed Authors
Users online (2,637)