Skip to content

Latest commit

 

History

History
281 lines (161 loc) · 13.8 KB

notify-manager-inspections.md

File metadata and controls

281 lines (161 loc) · 13.8 KB
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
joel-lindstrom
msftsamperl
mduelae
sbahl10

Notify a manager on completion of an inspection

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

Prerequisites

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 the Manage Inspections app

  1. Login into Teams, and select Power Apps from the left-pane.

  2. Select Build tab from the top.

  3. Select Manage Inspections to open the app in the editor.

Select Manage Inspections app

Add a new field to the Locations table

Next, we'll add a responsible person column to the location table so we can choose the responsible person for the area.

  1. On the Home screen, select See more under the Recent apps section.

    Select See more under the Recent apps section

  2. Go to the Installed apps tab, and select See all.

    Select See all option

  3. Select Area Inspection Location.

    [Select Area Inspection Location table]

  4. Select Add Column on the top-left.

  5. 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

    Add Responsible User column

    [!NOTE] Users must log in to the app one time before they can be selected from the user table.

  6. On the Build tab under Installed apps, select Manage Inspections.

  7. Select Area Inspection Locations from the left-pane, and then select Edit.

    Edit Area Inspection Locations Table

    The Responsible User ID column gets added to the Area Inspection Locations table.

  8. Update the Area Inspection Location with the Responsible User values.

    Responsible User column in the Area Inspection Locations table

Add Responsible User field on the Items Screen on Locations table

Now that we've added the responsible user to the location, we'll now display it on the Items screen.

  1. 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.

  2. 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)

  1. Copy the Title label control by highlighting it, and selecting Ctrl + C to copy it.

  2. Use Ctrl + V to paste the label.

  3. 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)
  4. Rename control to lblAreaDetails_ResponsibleIUser.

  5. 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)
  6. Rename control to lblArea_ResponsibleUser.

    The screen then looks like this.

Responsible User field on Locations screen

  1. Press Alt key, and select the Edit label on the top-right of the Items screen. The Title label is same as created above.

  2. 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"
  3. Rename control to txtArea_EditResponsibleUser.

    The screen then looks like this.

Locations Screen

  1. 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.

    Select Add Location button

  2. Verify that the Responsible User label and the textbox show up while adding a new Location.

    The screen then looks like this.

    Responsible User field on the Add Location screen

  3. 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 -.

    Update patch with Responsible User definition

Update second patch with Responsible User definition

Whenever a location is created or updated now, the Responsible User value will also be captured and saved on the Location record.

Publish the Manage Inspections app

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.

Publish to Teams

Confirm publishing to Teams

Add to Channel

Edit the inspection app

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.

Select Inspection App

Add a Flow to send an Email to the Manager

  1. From the Tree View, select the Review Screen.

  2. Select the Continue Inspection (btnContinueSubmitInspection) button.

  3. Select the OnSelect property option, copy the entire formula from the formula bar, and then paste it in a text editor.

  4. Select the Continue Inspection button, and select ... (ellipsis) on the top, and then select Power Automate.

    Trigger a Flow on the click of Continue Inspection button

  5. Select + Create to create a new flow on Power Automate.

Create a Flow to send an email to the Manager of the Responsible User

  1. Select the Power Apps trigger from the list.

  2. Create the flow Send Manager Notification of Completion of Inspection.

  3. Select Ask in Power Apps option for the Get Inspection Record – Row ID step, and for the Send an Email – To step.

    Flow steps to send notification

    Notification flow send email step

  4. Save the flow.

  5. Go back to the Power Apps Studio in Teams.

  6. Select this flow created from the available flows list. Most likely, the existing formula on the button will get erased out.

  7. 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');
    
  8. 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.

  9. Save the app.

Publish the Inspection 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.

Inspection App Publish to Teams

Confirm publishing Inspections app to Teams

Add Inspection App to Channel

Verify that a manager exists for the Responsible User

  1. Open the link admin.microsoft.com.

  2. Select Edit a user.

    Verify User has a Manager

  3. 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.

Test the app

  1. Select the Welcome screen from the Tree view in the Editor.

  2. Select the Preview button to run the app.

    Preview Inspection App

  3. Select Perform an Inspection.

    Perform an inspection button

  4. Perform the inspection as shown below.

    Complete Inspection Demo

    The flow should run after the Submit Inspection button is selected.

  5. The easiest way to confirm if the flow ran fine is by opening the Power Automate flow and checking the last run.

    Flow run history

    Flow successful run steps

  6. 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.

    Email screenshot

See also