title | description | author | ms.topic | ms.custom | ms.date | ms.author | ms.reviewer | contributors | ||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Notify a manager on completion of an inspection (contains video) |
Learn about the changes that would be required to notify the manager on completion of an inspection. |
msftsamperl |
conceptual |
08/16/2021 |
saperlmu |
mkaur |
|
The Inspections sample app template allows users to create and perform inspections in the app. There are three apps - one per persona to perform, manage, and review Inspections. The three apps are—Inspections, Manage Inspections and Review Inspections.
Let’s say you're using inspections to investigate a report of a problem in an area. And for unresolved issues, you want to notify the manager of the person responsible for the area so that they can provide the employee with coaching. In this article, we'll learn how to send a notification to the manager of the person responsible for the location being inspected.
The outcome is that the Inspection app can be used to verify that employees are maintaining an area, and provide notification to management if there are issues. For example, the store manager may want to know if the supervisor of the electronics section of a store is properly maintaining the area of their store and if an issue is found, send their manager an email.
Note
Before you begin, read Customize the Inspection app.
Watch this video to learn how to configure manager notification on completion of an inspection: https://www.microsoft.com/videoplayer/embed/RWLn9G
To complete this lesson, we'd need the ability to log into Microsoft Teams that will be available as part of select Microsoft 365 subscriptions, and will also need to have the Inspections sample app for Microsoft Teams installed. This app can be installed by following the installation guide.
-
Login into Teams, and select Power Apps from the left-pane.
-
Select Build tab from the top.
-
Select Manage Inspections to open the app in the editor.
Next, we'll add a responsible person column to the location table so we can choose the responsible person for the area.
-
On the Home screen, select See more under the Recent apps section.
-
Go to the Installed apps tab, and select See all.
-
Select Area Inspection Location.
-
Select Add Column on the top-left.
-
Enter the following column details, and then select Done to create the Responsible User column.
- Display name – Responsible User
- Data type – Lookup
- Related table – User
[!NOTE] Users must log in to the app one time before they can be selected from the user table.
-
On the Build tab under Installed apps, select Manage Inspections.
-
Select Area Inspection Locations from the left-pane, and then select Edit.
The Responsible User ID column gets added to the Area Inspection Locations table.
-
Update the Area Inspection Location with the Responsible User values.
Now that we've added the responsible user to the location, we'll now display it on the Items screen.
-
The Responsible User field needs to be added to the Display, Edit, and New sections of the Items Screen. The controls for each of these are all on the same screen but their visibility is controlled by variables. Open the Items Screen by selecting it in the Tree view and select the container conAreaDetails.
-
Press down the Ctrl key, and select the label Title.
![Copy Title label]https://user-images.githubusercontent.com/122298060/215219759-c2a886c2-73ba-4782-b4c0-4636f83d0d8f.png)
-
Copy the Title label control by highlighting it, and selecting Ctrl + C to copy it.
-
Use Ctrl + V to paste the label.
-
Update the properties of the new label
Property Value Text “Responsible User” X txtArea_EditTitle.X+txtArea_EditTitle.Width+20
Y If(gblEditLocation || gblAddLocation, 107+150, 61+90)
-
Rename control to lblAreaDetails_ResponsibleIUser.
-
Copy and paste the label that says Backstage and update the properties:
Property Value Text gblLocation.'Responsible User'.'Full Name'
X txtArea_EditTitle.X+txtArea_EditTitle.Width+20
Y If(gblEditLocation || gblAddLocation, 136+150, 91+90)
-
Rename control to lblArea_ResponsibleUser.
The screen then looks like this.
-
Press Alt key, and select the Edit label on the top-right of the Items screen. The Title label is same as created above.
-
Copy and paste the textbox that says Ambient, and update the properties:
Property Value Default If(gblAddLocation, "", gblLocation.'Responsible User'.’Full Name’)
X txtArea_EditTitle.X+txtArea_EditTitle.Width+20
Y If(gblEditLocation || gblAddLocation, 136+150, 91+90)
Hint Text "Full Name" -
Rename control to txtArea_EditResponsibleUser.
The screen then looks like this.
-
Now, press Alt key, and select Cancel on the top-right. And then press Alt key, and select the Add location button on the top-left of the Items screen.
-
Verify that the Responsible User label and the textbox show up while adding a new Location.
The screen then looks like this.
-
Select the Save button, and on the OnSelect property, add the following formula to the Patch functions
, 'Responsible User': txtArea_EditResponsibleUser in the two places shown below -
.
Whenever a location is created or updated now, the Responsible User value will also be captured and saved on the Location record.
All the changes to the Manage Inspections app are completed. The app can now be published by selecting the Publish to Teams button on the top-right.
Now that we've added the field to the Manage Inspections app, we'll create a process to notify the manager of the responsible user when there's an issue.
After publishing the Manage Inspections app, select the Back button to go back to the Build > Installed Apps screen > Select Inspection.
-
From the Tree View, select the Review Screen.
-
Select the Continue Inspection (btnContinueSubmitInspection) button.
-
Select the OnSelect property option, copy the entire formula from the formula bar, and then paste it in a text editor.
-
Select the Continue Inspection button, and select ... (ellipsis) on the top, and then select Power Automate.
-
Select + Create to create a new flow on Power Automate.
-
Select the Power Apps trigger from the list.
-
Create the flow Send Manager Notification of Completion of Inspection.
-
Select Ask in Power Apps option for the Get Inspection Record – Row ID step, and for the Send an Email – To step.
-
Save the flow.
-
Go back to the Power Apps Studio in Teams.
-
Select this flow created from the available flows list. Most likely, the existing formula on the button will get erased out.
-
Update the Run Flow formula as shown below.
SendManagerNotificationofCompletionofInspection.Run(If( !IsBlank(gblSelectedLocation.'Responsible User'.'Primary Email'), Office365Users.ManagerV2(gblSelectedLocation.'Responsible User'.'Primary Email').mail ),gblLastInspection.'Area Inspection');
-
Copy the old Continue button formula back from the text editor from Step 3 of the Add a Flow to send an Email to the Manager section before the flow formula used in the previous step.
-
Save the app.
All the changes to the Inspection app are completed. The app can now be published by selecting the Publish to Teams button on the top-right.
-
Open the link admin.microsoft.com.
-
Select Edit a user.
-
Select a User and confirm that the user has a Manager assigned.
[!NOTE] If you're working on your organization’s environment, then you'd most likely not need this step. But if working from a trial environment, it is better to create another trial user and add that user as the manager to the Responsible user.
-
Select the Welcome screen from the Tree view in the Editor.
-
Select the Preview button to run the app.
-
Select Perform an Inspection.
-
Perform the inspection as shown below.
The flow should run after the Submit Inspection button is selected.
-
The easiest way to confirm if the flow ran fine is by opening the Power Automate flow and checking the last run.
-
Confirm that the email was sent to the right address by selecting and expanding the Send an email step from the flow results.
The email received is as shown below.