Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow Murray Fife, July 2017
Page 1
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow Introduction This morning I received an email from our internal global security group that asked me if I was safe or needed assistance, because Hurricane Irma is rolling it’s way through Georgia. I had two thoughts. First was how nice is that, and the second was that I could build that notification app myself using the Common Data Service and Flow. So in this walkthrough I will show all of the steps that I went through to create an Employee Status Check-in process that will send out an email to all of the employees and allow them to reply with their status. And along the way, highlight how easy it is to use PowerApps to quickly create notifications and tracking processes.
Topics Covered Creating a Check-in Status Picklist .............................................. 3 Adding a Check-In Status field to the Employee Entity ........................... 14 Creating a Check-in Status Email Flow ........................................... 20 Running the Employee Check-in Process ........................................... 44 Conclusion ...................................................................... 48
Page 2
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow Creating a Check-in Status Picklist The first thing that we will do will be to create a picklist that we will use to track all of the different check-in statuses for the employees.
How to do it‌ To do this we will open up PowerApps and then select the Picklists item from the Common Data Service group, and then click on the New Picklist button.
This will open up a New picklist dialog panel where we can start defining our new picklist.
Now we will want to give out Picklist a name. To do this we will just need to update the Name value. For this example, we will want to set the Name to CheckInStatus.
Page 3
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Nest we will give the picklist a more human readable dispay name. To do this we will just need to update the Display Name value and then click on the Next button. For this example, we will want to set the Display Name to Check-in Status.
This will open up the Picklist maintenance form.
Page 4
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Next we will want to change the name that is displayed for the item. To do this we will just need to update the Display Name value. For this example, we will want to set the Display Name to Safe.
Page 5
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Finally we will want to change the description if the picklist item. To do this we will just need to update the Description value. For this example, we will want to set the Description to I am safe.
Now we will want to add some more picklist items with different statuses. add another check-in status for those who suffered damage. To do this just click on the New item button.
Page 6
We will
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
This will create a new record for us and we can start adding the information for our second status. We will start off by adding a new name for our second status. To do this we will just need to update the Name value. For this example, we will want to set the Name to Damage.
Then we will add the text to display with the status code. To do this we will just need to update the Display Name value. For this example, we will want to set the Display Name to Safe but damage.
Page 7
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
And then add a more detailed description for the status. To do this we will just need to update the Description value. For this example, we will want to set the Description to I am safe but have damage.
Now we will create a third picklist option for people that have been evacuated. To do this just click on the New item button.
Page 8
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Again we will start off by adding a new name for our second status. To do this we will just need to update the Name value. For this example, we will want to set the Name to Evacuated.
Next we will add a display name for the item. To do this we will just need to update the Display name value. For this example, we will want to set the Display name to Safe and have evacuated.
Page 9
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
And then we will add a more detailed description for the picklist item. To do this we will just need to update the Description value. For this example, we will want to set the Description to I am safe and have been evacuated.
We will create one final picklist item for the most important status, and that is to mark employees that they need assistance. To do this just click on the New item button.
Page 10
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Again, we will give our check-in status a name. To do this we will just need to update the Name value. For this example, we will want to set the Name to Assistance.
And then give the check-in status a display name. To do this we will just need to update the Display name value. For this example, we will want to set the Display name to Need assistance.
Page 11
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
And now we will add a more detailed description for the check-in status. To do this we will just need to update the Description value. After we have done that we can click on the Save button. For this example, we will want to set the Description to I need assistance.
This will then save the picklist structure away for us.
Page 12
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
After the picklist is saved back to the Common Data Service we will return back to the picklist and we will be able to see all of the items that we can choose from.
Page 13
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow Adding a Check-In Status field to the Employee Entity Once we have created our picklist for the check-in statuses we will be able to move on to the next step in the process which is to add a status field to our workers that will allow us to track their current situation.
How to do it‌ We will start off by finding the worker entity. To do this just click on the Entities button from the Common Data Service group.
Now we will want to find the Worker entity. An easy way to fo this is to use the Search field to filter out the entities, and then select the Worker entity. For this example, we will want to type in worker into the Search box.
Page 14
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow This will open up the Worker entity for us. Now we will want to add a new field to the entity to track the employee status. To do this just click on the New field button.
This will open up a New field panel where we will be able to define the properties for our field.
We will start off by giving our field a friendly display name. To do this we will just need to update the Display name value. For this example, we will want to set the Display name to Check-in Status.
Page 15
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Then we will want to give our field a name. This will be the system name for the field and cannot contain any spaces. To do this we will just need to update the Name value. For this example, we will want to set the Name to CheckInStatus.
Now we will want to select the data type for the field. To do this we will just need to select the Type from the dropdown list. For this example, we will want to click on the Type dropdown list and select Picklist.
Page 16
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Since we chose to use the Picklist type for the field we will now need to select the picklist that we want to use for the field. To do this we will just need to select the Picklist from the dropdown list. For this example, we will want to click on the Picklist dropdown list and select Check-in Status.
After we have done that we can create the field and add it to the Worker entity. To do this just click on the Add field button.
Page 17
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
When we return back to the Worker entity we will be able to scroll down to the bottom of the list of fields and see that our new field is there. All we need to do now is to save the field and update the entity. To do this just click on the Save Entity button.
This will start the process of saving the field to the entity for us.
Page 18
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
When we return back to the entity we will see that the field has now been added for us.
Page 19
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow Creating a Check-in Status Email Flow Now that we have the field that is able to track the status of the employee added to the Worker entity we can start building the flow that will allow us to initiate a set of emails to the workers where they can update their status.
How to do it‌ To do this we will want to open up Flow and then view our personal flows. To do this just click on the My flows button.
Now we will want to create a new Flow, and we will start off with a blank template. To do this just click on the Create from blank button.
This will take us to the flow creation page where we can select the action that we want to use to initiate the process.
Page 20
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow We will want to use a flow button to start these flows, and that is not showing up in the popular triggers so we will want to search all of the triggers. To do this just click on the Search hundreds of connectors and triggers button.
When all of the triggers are listed we will see that there is a Flow button for mobile option that is an easy way to initiate flows. To do this just click on the Flow button for mobile button.
This will filter out the flow triggers to just the mobile button option. Now we will want to select the trigger. To do this just click on the Flow button for mobile - Manually trigger a flow button.
Page 21
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
After we have done that we will see that our trigger event is added to the flow.
Now we will want to add a step that goes out and finds all of the workers for us so that we can send them notifications. To do this just click on the New step button and then click on the Add an action button.
Page 22
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
This will open up a list of all of the actions that we are able to add to our flow.
We want to use one of the Common Data Service actions so we will need to filter out the list of actions a little. To do this we will just need to type in common into the Search box and then select the action. For this example, we will want to type in common into the Search box and then select the Common Data Service – Get list of records action.
Page 23
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
This will add an action to the flow that will allow us to look up records in the Common Data Service.
Now we will want to select the database that we want to use. To do this we will just need to select the The database from the dropdown list. For this example, we will want to click on the The database dropdown list and select default.
Page 24
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
And then we will want to select the worker entity. To do this we will just need to select the The entity from the dropdown list. For this example, we will want to click on the The entity dropdown list and select Worker.
After we have done that we are done with the step. This activity will go to the Common Data Service Worker entity and return all of the records for us.
Page 25
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Now we will want to create a step that will take all of the records that we get from the Common Data Service and allow us to process them individually. To do this just click on the New step button, then click on the More link and then select the Add an apply to each button.
This will add an Apply to each step to the flow.
Page 26
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Now we will want to tell the loop to loop through the worker records. To do this just click on the Select an output from previous steps button, which will allow us to see the Dynamics content panel where we can select the value that we want to use in the loop. For this example we will click on the value option from the Get list of records step.
Now we will want to add a step to the flow that will send out an e-mail to the workers email. To do this just click on the Add an action button.
Page 27
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
This will open up the Action browser where we can select the next action. We will now want to add a step that will send out an e-mail with approval options. To do this just click on the Office 365 Outlook - Send approval email button.
This will add in a new action for the approval email which will be sent to all of the employees.
Page 28
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Now we will want to specify who we want to send the email to. To do this we will just need to click on To field and then select the email field from the worker entity. For this example, we will want to add Email primary to the To field.
Now we will want to add a subject for the email message to get everyone's attention. To do this we will just need to update the Subject value. For this example, we will want to set the Subject to Action Required! Employee Accountability Check.
Page 29
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Next we will want to specify the different options that we want to include in the email as responses. To do this we will just need to update the User Options value. For this example, we will want to set the User Options to I am safe, I am safe but have damage, I am safe and have evacuated, I need assistance.
Before we finish this step we will want to make a quick change and update some or the advanced fields. To do this just click on the Show advanced options button.
Page 30
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Since this is a important email we will want to mark it as important. To do this we will just need to select the Importance from the dropdown list. For this example, we will want to click on the Importance dropdown list and select High.
We will also want to add some text for the body of the email so that the employees know what this message is about. To do this we will just need to update the Body value. For this example, we will want to set the Body to On behalf of Contoso we are conducting a welfare check of our employees. Please respond by selecting one of the following:.
Page 31
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Now we will want to add a case action to the flow that will process each of the different responses. To do this just click on the More link and then on the Add a switch case button.
This will add a Switch Case step where we will be able to process all of the different responses.
Page 32
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Before we can use the Switch Case we will need to tell it what we are branching on. To do this we will just need to update the To value. For this example, we will want to click on the To field and when the content dialog is displayed, select the SelectedOption field.
Now we will want to specify the condition for the first branch of the Switch Case. To do this we will just need to update the Equals value. For this example, we will want to set the Equals to I am safe.
Page 33
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Next we will want to add another branch for the damaged condition. To do this we will just need to click on the + button to create a new branch and then update the Equals value. For this example, we will want to set the Equals to I am safe but have damage.
Let’s add our third option to the flow for the people that have evacuated. To do this we will just need to update the Equals value. For this example, we will want to click on the + button to create a new branch and then set the Equals to I am safe and have evacuated.
Page 34
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
And now we will add our final path to the Switch Case for the employees that need assistance. To do this we will just need to update the Equals value. For this example, we will want to click on the + button to create a new branch and then set the Equals to I need assistance.
Now that we have all of the branches defined we can start adding actions to each of them. To do this just click on the Add an action button.
Page 35
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
We will want to update the record within the Common Data Service with the employees status, so now we will want to find the action that will allow us to do that. To do this just find the Common Data Service - Update a record action and click on it.
This will add an action to the safe condition that will allow us to update the entities in the Common Data Service.
Page 36
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Now we will want to select the database that we are going to be updating. To do this we will just need to update the The database value. For this example, we will want to set the The database to default.
Next we will want to select the entity for the worker. To do this we will just need to update the The entity value. For this example, we will want to set the The entity to Worker.
Page 37
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
And then we will want to specify the record key that we want to update. To do this we will just need to update the Key value value. For this example, we will want to set the Key value to Worker ID.
Finally we will want to specify the status of the worker. To do this we will just need to select the Check-in Status from the dropdown list. For this example, we will want to click on the Check-in Status dropdown list and select Safe.
Page 38
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Now we want to repeat the process for the second condition, but for this branch we will want to mark the employee as having damage. To do this we will just need to select the Check-in Status from the dropdown list. For this example, we will want to click on the Check-in Status dropdown list and select Damage.
Again, we will repeat the process for the third condition, but for this branch we will want to mark the employee as evacuated. To do this we will just need to select the Check-in Status from the dropdown list. For this example, we will want to click on the Check-in Status dropdown list and select Evacuated.
Page 39
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Finally we will want to repeat the process for the last condition, but for this branch we will want to mark the employee as having damage. Also we will for this condition we will want to add an email action to send a notice to the management group. To do this we will just need to select the Check-in Status from the dropdown list. Then click on the Add an action button and add a Send an email action. For this example, we will want to click on the Check-in Status dropdown list and select Assistance.
Next we will want to specify who we want to send the email to. To do this we will just need to update the To value. For this example, we will want to set the To to the Managers email.
Page 40
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Now we will want to build up the Subject line of the email. To do this we will just need to update the Subject value. For this example, we will want to set the Subject to Assistance Required for and then select the Full Name field from the dynamics content.
And we will also want to update the body of the email as well. To do this we will just need to update the Body value. For this example, we will want to set the Body to Assistance Required for and then select the Full Name field from the dynamics content.
Page 41
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
All that is left to do now is to give our flow an name and then create it. To do this we will just need to update the Flow name value and then click on the Create flow button. For this example, we will want to set the Flow name to Employee Accountability Check.
After we have done that our Flow will be ready to run.
Page 42
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
Page 43
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow Running the Employee Check-in Process Now that we have our accountability flow created we can test it out and see how it works.
How it works‌ All we need to do is tell Flow that we want to run our new process that we built. To do this just click on the Run now button.
The first time that we run the flow, we will be asked if we want to use the default connections, and we do. To do this just click on the Continue button.
Then we will be given a final confirmation that we want to run the flow. To do this just click on the Run flow button. Page 44
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
After we have done that the flow will begin processing for us and we will get a dialog box telling us just that which we can dismiss. To do this just click on the Done button.
The flow will now kick off the notification process and the employees will start receiving Status Check-in requests. All we need to do here is select the status. To do this just click on the I am safe button.
Page 45
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
After selecting the status, the email will then notify them that the status has been processed.
Behind the scenes the flow will run and then process the response.
Page 46
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow
And if we look at the data within the Common Data Service we will see that the status has been updated on the Worker record.
Page 47
Creating an Employee Disaster Email Check-in Application using Power Apps and Flow Conclusion How cool is that. Within just a couple of minutes we have been able to create a flow that allows us to check in with all of our employees and allow them to quickly respond with their status.
Page 48