Practice Lab 4.1 – Enhance a canvas app

Scenario

You are a Power Platform functional consultant and have been assigned to the Fabrikam project for the next stage of the project.

You have been assigned to continue work on the Fabrikam Environmental Work Delivery canvas app.

In this practice lab, you will examine the app to see how it works and make some user interface changes.

If your browser is not set to English, the syntax of Power Fx formulas might change. See Build global support into canvas apps https://learn.microsoft.com/power-apps/maker/canvas-apps/global-apps for more information.

Exercise 1 – Examine the canvas app

In this exercise, you will learn about the canvas app.

Task 1.1 - Run the app

  1. Navigate to the Power Apps Maker portal https://make.powerapps.com.

  2. Make sure you are in the Dev One environment.

  3. Select Solutions.

  4. Open the Fabrikam Environmental solution.

  5. In the Objects pane on the left, select Apps.

  6. Select the Environmental Work Delivery app, select the Commands menu (…), and select Play.

  7. Sign in with your Microsoft 365 credentials, if prompted.

  8. The app has 4 screens which are navigated using the left-hand navigation bar:

    • Home: Contains three tiles that show the count of Projects, Milestones, and Outcomes.
    • Projects: Create and edit Projects
    • Milestones: Set Percentage Complete on Milestones
    • Outcomes: Update the details of Outcomes
  9. Note that the label for Outcomes is incorrect. This is an issue your client, Fabrikam, has raised that needs to be fixed.

  10. Select the Projects screen (second icon).

  11. Note that Type is blank for existing projects.

  12. Note that the colors for the drop down controls are blue.

  13. Select the + icon. A new Project row is added.

  14. Enter Lab Project for Project Title.

  15. Select any Type.

  16. Select In Progress in the Status drop-down.

  17. Select a date in the next month in the Estimated date date picker and select OK.

  18. Select the Back arrow icon in the bottom-left of the screen to return to the Home screen. The number in the first tile will have incremented.

  19. Select the Milestones screen (third icon).

  20. Enter 50 in Milestone Percentage Complete

  21. Select the Outcomes screen (fourth icon).

  22. Enter To create a better planet in Goal.

  23. Select Completed in the Status Reason drop-down.

  24. Select Save.

  25. Select the Home screen (first icon).

  26. Close the app.

Task 1.2 - Review the app in Power Apps Studio

  1. Select the Environmental Work Delivery app, select the Commands menu (…), and select Edit > Edit in new tab.

  2. If a Welcome to Power Apps Studio dialog appears, check Don’t show me this again, and select Skip

  3. In the Tree view, expand Card1.

  4. Select Card1LabelValue and select Text in the Property Selector.

  5. Review the formula. Note that the filter uses the My Active Projects view.

  6. In the Tree view, select and expand ProjectScreen.

  7. In the Tree view, select and expand ProjectGallery.

  8. Select ProjectStatusDropDown and select Items in the Property Selector.

  9. Review the formula. Note the use of Choices.

  10. Select ProjectStatusDropDown and select OnChange in the Property Selector.

  11. Review the formula. Note the use of Patch.

  12. Select ProjectTitleTextInput and select OnChange in the Property Selector.

  13. Review the formula. Note the use of Patch.

  14. In the Tree view, select and expand MilestoneScreen.

  15. Select and expand MilestoneForm.

  16. Select and expand Milestone Percentage Complete

  17. Select DataCardValue2 and select OnChange in the Property Selector.

  18. Review the formula. Note the use of SubmitForm.

  19. In the Tree view, select and expand OutcomeScreen.

  20. Select and expand OutcomeForm.

  21. Select Button2 and select OnSelect in the Property Selector.

  22. Review the formula. Note the use of SubmitForm.

  23. Select HomeScreen.

  24. In the Tree view, select App.

  25. Select OnStart in the Property Selector.

  26. Review the formulas.

  27. Select the ellipsis menu (…) to the right of App and select Run OnStart.

  28. In the left navigation, select (𝑥) Variables.

  29. Expand Global variables and review the variables for column widths and heights. The controls on screens use these variables for their X, Y, Height, and Width.

  30. Review the Color variables. The controls on screens use these variables for color properties.

  31. In the left navigation, select Tree view.

  32. Select TitleLabel under HomeScreen.

  33. Select X in the Property Selector and note the use of a variable.

  34. Select Y in the Property Selector and note the use of variables in the formula.

  35. In the left navigation, select (𝑥) Variables.

  36. Expand Collections.

  37. Review the data in the collections by selecting the ellipisis menu (…) on each and selecting View table. Select Cancel to close the pop-up.

  38. Close the tab and select Leave to discard any changes. Select Done.

Exercise 2 – Change the visual experience of the canvas app

In this exercise, you will change the layout and colors used in the canvas app so that you can see how the layout of the app has been created.

Task 2.1 - Layout

In this task, you will perform the following changes to the app:

  • change the variables used for column and row layout
  1. Navigate to the Power Apps Maker portal https://make.powerapps.com

  2. Make sure you are in the Dev One environment.

  3. Select Solutions.

  4. Open the Fabrikam Environmental solution.

  5. In the Objects pane on the left, select Apps.

  6. Select the Environmental Work Delivery app, select the Commands menu (…), and select Edit > Edit in new tab.

  7. In the Tree view, select App.

  8. Select OnStart in the Property Selector.

  9. In the OnStart, change Set(BarrierSize,20) to Set(BarrierSize,10)

    Note: You can select the caret to the right of the formula bar to expand it.

  10. Select the ellipsis (…) to the right of App and select Run OnStart. Verify that the layout adjusts and the tiles become bigger.

  11. In the OnStart, change Set(LeftHandWidth,App.Width/10) to Set(LeftHandWidth,App.Width/12)

  12. Select the ellipsis (…) to the right on App and select Run OnStart. Note that the layout adjusts.

  13. Close the tab and select Leave to discard any changes. Select Done.

Task 2.2 - Colors

In this task, you will perform the following changes to standardize colors for the controls in the app:

  • change the variables used for colors
  • update the colors used for controls in the gallery
  1. Select the Environmental Work Delivery app, select the Commands menu (…), and select Edit > Edit in new tab.

  2. In the Tree view, select App.

  3. Select OnStart in the Property Selector.

  4. In the OnStart, change Set(FabrikamBackColor,RGBA(0,0,0,1)) to Set(FabrikamBackColor,Color.Azure)

  5. In the OnStart, change Set(FabrikamFrontColor,RGBA(255,255,255,1)) to Set(FabrikamFrontColor,Color.Black)

  6. Select the ellipsis (…) to the right of App and select Run OnStart. Note that the colors change.

  7. Select Save.

  8. In the Tree view, select and expand ProjectScreen.

  9. Select and expand ProjectGallery.

  10. Select ProjectTitleTextInput and select BorderColor in the Property Selector.

  11. Replace the RGBA value in the formula bar with FabrikamColor

  12. Select ProjectTypeComboBox and select ChevronBackGround in the Property Selector.

  13. Replace the RGBA value in the formula bar with FabrikamColor

  14. Select BorderColor in the Property Selector for the ProjectTypeComboBox.

  15. Replace the RGBA value in the formula bar with FabrikamColor

  16. Repeat the steps to change the BorderColor and ChevronBackground color to FabrikamColor for ProjectStatusDropDown.

  17. Repeat the steps to change the BorderColor and IconBackground color to FabrikamColor for EstimatedCompletionDate.

    Canvas app colours.

  18. Select Save.

Task 2.3 - Background

In this task, you will perform the following changes to a screen:

  • add an image as a background
  1. In the Tree view, select ProjectScreen.

  2. In the Properties pane on the right side, select Background image > + Add an image file.

  3. Locate and select the Texture.jpg file and select Open.

    This file is located in the Documents\PL-200 folder on your machine.

  4. The image will be added as the background for the screen.

  5. Select Fit in the Image position drop-down.

    Canvas app background.

  6. Select Save.

Task 2.4 - Label

In this task, you will perform the following changes to a label:

  • correct the card label on the home screen
  1. In the Tree view, select and expand HomeScreen.

  2. Select and expand Card3.

  3. Select Card3LabelValue and view the Text Property. Note that this card is displaying the count of Active Outcomes, but the label incorrectly says Active Milestones.

  4. Select Card3LabelHeader and select Text in the Property Selector.

  5. In the formula bar, change Active Milestones to Active Outcomes

    Canvas app home.

  6. Select Save.

Task 2.5 - Button

In this task, you will perform the following changes to the button:

  • change the name of the button
  • set the button as disabled if there are no rows
  1. In the Tree view, select and expand OutcomeScreen.

  2. Select the ellipsis (…) next to Button2 and select Rename.

  3. Enter SaveBtn

  4. With the button still selected, select DisplayMode in the Property Selector.

  5. Enter the following formula:

    If(CountRows(OutcomeGallery.AllItems) > 0, DisplayMode.Edit, DisplayMode.Disabled)

  6. Select Save.

  7. Select Publish.

  8. Select Publish this version.

Exercise 3 – Logic

In this exercise, you will update formulas and logic in the canvas app. There are several issues with logic in the app:

  • the forms used on Milestone and Outcome screens only update Dataverse for the first row in the gallery.
  • the project types are not displayed for existing projects.

Task 3.1 - Outcome Status

In this task, you will perform the following changes to the screen:

  • remove the Status Reason column and replace with the new Status choice column
  1. Navigate to the Power Apps Maker portal https://make.powerapps.com.

  2. Make sure you are in the Dev One environment.

  3. Select Solutions.

  4. Open the Fabrikam Environmental solution.

  5. In the Objects pane on the left, select Apps.

  6. Select the Environmental Work Delivery app, select the Commands menu (…), and select Edit > Edit in new tab.

  7. In the Tree view, select and expand OutcomeScreen.

  8. Select and expand OutcomeForm.

  9. In the Properties pane, select Edit fields.

  10. Select + Add field.

  11. Select Outcome Status

  12. Select Add.

  13. Select the More actions menu (…) next to Status Reason and select Remove.

  14. Select and expand OutcomeGallery.

  15. Select Subtitle5_1 and select Text in the Property Selector.

  16. In the formula bar, replace ThisItem.’Status Reason’ with ThisItem.'Outcome Status'

    Canvas app with Outcome Status.

  17. Select Save.

Task 3.2 - Outcome form

In this task, you will perform the following changes to the screen:

  • correct the initialization of the form
  • use the LookUp formula with a Dataverse table
  1. Select and expand OutcomeGallery.

  2. Select NextArrow5_1 and select OnSelect in the Property Selector.

  3. In the formula bar, replace NewForm(OutcomeForm) with Select(Parent)

  4. Select OutcomeForm and select Item in the Property Selector.

  5. Enter the following formula:

    LookUp(Outcomes, Outcome = OutcomeGallery.Selected.Outcome)

  6. Select Save.

Task 3.3 - Milestone form

In this task, you will perform the following changes to the screen:

  • correct the initialization of the form
  1. In the Tree view, select and expand MilestoneScreen.

  2. Select and expand MilestoneGallery.

  3. Select NextArrow5 and select OnSelect in the Property Selector.

  4. In the formula bar, replace NewForm(OutcomeForm) with Select(Parent)

  5. Select Save.

Task 3.4 - Project type

In this task, you will perform the following changes to the screen:

  • display the Project Type for existing records
  1. In the Tree view, select and expand ProjectScreen.

  2. Select and expand ProjectGallery.

  3. Select ProjectTypeComboBox and select DefaultSelectedItems in the Property Selector.

  4. In the formula bar, enter ThisItem.'Project Type'

    Canvas app with Project Types.

  5. Select Save.

  6. Select Publish.

  7. Select Publish this version.

  8. Close the canvas app designer tab.

  9. Select Done.

Exercise 4 – Solutions

In this exercise, you will export the solution from the Development environment and import it into the Production environment.

Task 4.1 – Export managed solution

  1. Navigate to the Power Apps Maker portal https://make.powerapps.com

  2. Make sure you are in the Dev One environment.

  3. Select Solutions.

  4. Select the Fabrikam Environmental solution but do not open it.

  5. Select Export solution.

  6. Select Next.

  7. Change the version number to 1.1.11.13.

  8. Select Managed for Export As.

  9. Select Export.

  10. The export will be prepared in the background. When the solution is ready, select the Download button.

Task 4.2 – Export unmanaged solution

  1. Select the Fabrikam Environmental solution.

  2. Select Export solution.

  3. Select Next.

  4. Change the version number to 1.1.11.13.

  5. Select Unmanaged for Export As.

  6. Select Export.

  7. The export will be prepared in the background. When the solution is ready, select the Download button.

Task 4.3 – Import managed solution

  1. Switch to the Production environment using the Environment Selector in the upper right corner of the Maker portal.

  2. Select Solutions.

  3. Select Import solution.

  4. Select Browse, change to the Downloads folder and select FabrikamEnvironmental_1_1_11_13_managed.zip and select Open.

  5. Select Next.

  6. Select Import. The solution will import in the background.