cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Julien2
Level: Powered On

Get employee location flow with SharePoint

Hello everyone !

 

I am trying to build an Employee location form in SPO with microsoft flow to get the current employee location and update multiple columns based on check-in check-out.

 

I have 2 lists:

  • Employee form location (EmployeeName, Check-In, Check-Out)
  • Employee form Dashboard (EmployeeName, Check-In, Check-Out, Check-In Time, Check-out Time)
  • Check-In, Check-Out are dropdown list values. Check-in value is (check in), Check-out values are (None, check-out). (These values are in Employee form location).

 

Example:

  1. When the employee create new item and choose Check-In value in the Check-in column the flow will trigger his location and update the "Check-in" column where he is in the Employee Form list.
  2. I have another list called Employee Form Dashboard, whenever any employee create new item in the Employee form i want the flow to add the same item with his current location and the current "Check in Time" of this specific employee in this list.

  3. "Check in time" in Employee Form Dashboard the flow will trigger the current time that he checked in when the item is created in both lists. I want to make sure that the flow will update this column of this specific employee, and of his specific ITEM.
  4. Now suppose that the Employee finished his job in this place and he need to check out, so when he get back to the Employee form list, he edit the item, and he choose the value check out again it will trigger his location and update the "Check-out" columns from where he is in both lists.   (Employee Form & Employee Form Dashboard).

  5. Also i have another column "Check-out time" in Employee Form Dashboard it will trigger the current item that he checked out and update this column of this specific employee of this specific ITEM.

 

Any suggestion how to build this flow and is it possible to achieve it ?

@ScottShearer 

Thank you !!

6 REPLIES 6
Super User
Super User

Re: Get employee location flow with SharePoint

Hi @Julien2 

If your users are able to make use of the Flow mobile app it is fairly straightforward to get the data you need for this to work. Create a new Flow that is Manually Triggered (a Flow Button trigger). Details on button Flows can be found here https://docs.microsoft.com/en-us/flow/introduction-to-button-flows

When this Flow is activated via the mobile app, you will have access (assuming the user has granted it) to the devices latitude and longitude as well as the id of the logged in user. It is also possible to add inputs to this Flow button trigger so you can prompt for additional information either using a text box or a fixed list of items in a drop down (https://docs.microsoft.com/en-us/flow/button-flow-with-user-input-tokens).

Creating a button for Check In and another for Check Out, and then providing guidance to your Users on how to save these as home screen icons on their device (https://flow.microsoft.com/en-us/blog/widgets/), will provide a nice easy to use experience.

 

Hope that helps get you started. Shout if you have any further questions.

 


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Julien2
Level: Powered On

Re: Get employee location flow with SharePoint

Hello @LeeHarris 

 

Yes our users will use the Flow mobile app. The documentation you mentioned are very helpful. After reading those documentation i created 2 flows are "Check-In Flow" and "Check-Out Flow".

 

Check-In Flow will create new item in the list when the user choose Check-In in the mobile.

 

But i have a problem occur on Check-out flow.

 

First here is my Check-Out flow:

CheckOut Flow Error.PNG

Here is the result of Check-Out Time Flow Flow:

CheckOutTime.PNG
The problem is when the user click on check-out flow it updates all the check-out rows items for all users.

While it should only update the items based on the itemID for the specific User.

Suppose the user got 6 visits a day it should update the time  based on the itemID.

The filter query i used is wrong. 

EmployeeName/EMail eq '@{triggerOutputs()['headers']['x-ms-user-email-encoded']}'

So what should i do to make the flow trigger the ID of the item for the specific users ?

 

Thank you!

Super User
Super User

Re: Get employee location flow with SharePoint

Hi @Julien2 

The filter you have so far looks okay but you will need to add an additional condition to it so that it only updates the items that are not yet checked out. You could add a check for the Check Out Time being blank to your filter. It might also be worth adding a comparison between the Check In (Location) and the Check Out (Location) to the filter, perhaps with a little bit of padding around the latitude and longitude in case the User isnt in exactly the same location when they check out.

The filter would ideally look like (I'm not sure on the syntax but this should guide you)

Return all items WHERE Email equals Logged in User Email AND CheckOutTime does not contain data AND CheckIn equals FullAddress

 

Hope that helps.

 


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Julien2
Level: Powered On

Re: Get employee location flow with SharePoint


Hi @LeeHarris 

 

I have modified the filter query based on what you mentioned but i get an error in DateTime when running Check-Out flow. Considering the Check-out location also i have to fix this because maybe the user check-out in other location.


Here in filter query i think the syntax are rights but i am not sure if CheckOutTime eq '' means does not contain data.

 

EmployeeName/EMail eq '@{triggerOutputs()['headers']['x-ms-user-email-encoded']}' and CheckOutTime eq '' and CheckIn eq '@{triggerBody()['location']['fullAddress']}'

Updatedquery.PNGerrorquery.PNG

 

Maybe @ScottShearer  can guide us with the filter syntax.

 

Thank you!!

Super User
Super User

Re: Get employee location flow with SharePoint

Hi @Julien2 

There is a null value that can be found in the expression builder (see the below example of how to add this). This may allow you to check if the date is null. In your current filter you are checking if the Check Out Time equals a blank string which is causing the error.

 

2019-11-05_11-06-02.gifAdding Null from expression

 


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Julien2
Level: Powered On

Re: Get employee location flow with SharePoint

Hi @LeeHarris ,

 

I will check it out and let you know what will happen.

 

Thank you!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 209 members 5,268 guests
Please welcome our newest community members: