Microsoft Flow PowerApps Projects Time Management Apps - Part 1

Goal is to be able to manage how much time (in hours and minutes) the company spent each month. 
Each Employee should write down when he started and when he finished, and calculate the time. 
At each period of time we should be able to get a report of total time spend per client. 

Design: 

Data will be 2 SharePoint lists, one for clients names, other for the time spent. 
List 1 is Title only for client name. 
List 2:
  • Title - client name
  • Created - start time
  • Created By - employee
  • EndTime - end time ☺
  • TotalTime - calculated field for time (=TEXT(EndTime-Created, "hh:mm"))

App1 - Employee chooses client, has 2 buttons, start and end
App2 - Manager can choose month and gets a list of clients with their total time

Lets start, SP as states

App1


Drop "Items" Connected to SPList and "Value" to Title.
Button Start to Flow is very simple, create a sharepoint list item with title of selected client.
Since i wanted some message in the app i had the flow to return some answer with the current time, using "Convert time zone" step to convert "utcNow()" function to my format "hh:mm"



Start Button OnSelect
Set(MessageToClient, 'TimeRecordForEmployee_CreateItem'.Run(ddlClient.SelectedText.Value))

For the End Button the flow is a bit more complicated
We need to search the latest item for that client, so we start with "Get items" step, filtering Title to the value from the PowerApp and Order By "EndTime asc". Top count to 1, for ease.

*NOTE when i tried 2 filter i got and error using "AND", you must use "and".


Next we need to extract the ItemId, and the Title for the update step. also calculate the Now Time like last flow



Item extraction from array
Get 1st item from the "Get items" step, if not null use body content, body has "value" property, and that's the array, so 1st item from that, them get field.

first(outputs('Get_items')?['body/value'])['ID']
first(outputs('Get_items')?['body/value'])['Title']

Finishing the flow with "Update item" and respond, since Title is a Required field we must re-set it, and also we need the item is. For the EndTime we're using "utcNow()"




Part 2 for App2

Comments

Popular posts from this blog

OverTheWire[.com] Natas Walkthrough - JUST HINT, NO SPOILERS

Asp.Net Ending Response options, Response.End() vs CompleteRequest()

SOLVED The item could not be indexed successfully because the item failed in the indexing subsystem