cancel
Showing results for 
Search instead for 
Did you mean: 
chass

Adv Hands On Lab1: Package components in development environment and deploy, patch, and upgrade to production

 

Scenario

Application lifecycle management (ALM) is a vital part of a successful strategy for Power Platform projects. Contoso has provisioned a new development instance and would like to set up a build and deploy process where modifications of any of the components are only performed in the development environment and then deployed as a managed solution to the production environment. Components required to be deployed include a model-driven app and a canvas app. They also would like to take advantage of new tools like Solution Checker to monitor the health of what they are building.

You will be packaging components as a new unmanaged solution in the development environment and deploy, patch, and upgrade this solution in the production environment as managed.

 

Environment

 

The lab requires two PowerApps environments with a Common Data Service database created and the sample apps installed.

You are working in a shared tenant. Do not do your exercises in the default environment. You have been assigned a development environment and a production environment for this course.

Note: Specifically, for the labs in this course, it is best always to use a private/incognito browser session.

Provided for students:

  • Unmanaged solution that contains a model-driven app that includes account and contact.
  • Existing sample canvas app that uses a gallery control to display accounts.

Requirements

The following have been identified as requirements you must implement to complete the project.

  • R0 – In the production environment, a user must be able to start a model-driven app that includes access to Accounts and Contacts entities.
  • R1 – User must be able to run the canvas app providing access to accounts using a gallery control.
  • R2 – Maker must be able to run Solution Checker and resolve any issues flagged.
  • R3 – Maker must be able to add and remove components from the managed solution in the production environment by deploying patches and upgrades.

Exercise 1 – Setup the Development Environment

In this exercise, you will be preparing your new environment with some existing assets, so we can then look at how we can package all this into a solution file and deploy.

High-level tasks

Task 1– Install solution checker.

Task 2– Import solution ContosoBase. Publish it and confirm the model-driven Account Project Tracker App and its sitemap have imported.

Task 3– Import canvas app package named Accounts; open the app, and authorize its use.

Task 1: Install Solution Checker

The solution checker feature is a static analysis tool that reviews the solutions you build looking for anything that might impact performance, stability, and reliability of what you build. Currently, it requires a small installation; in the future, it will be pre-installed.

Note: As of the writing of this document, this feature is actively being added to all data centers. If you find no Solution Checker in the ribbon of your environment, don’t worry! That means you already have it and can proceed to the next task.

  • Navigate to https://make.powerapps.com and log in. Make sure you are in your development environment.
    • Select Solutions and click Solution Checker
    • If you only see the install option like the image then click Install otherwise it is already installed, and you can continue to Task 2.

     


    1. Click Get it Now.


    1. Click Continue.
    2. If you agree, accept the terms and conditions, select your dev environment and click Agree.

    1. You should be automatically redirected to the Manage your solutions page. Locate PowerApps Checker and make sure the installation is pending.  For your own enviroments you will need to use the attached applications (see below)


    1. You may close the browser tab. The installation will continue in the background.
    2. Click Done.


     

    Task 2: Import Solution

    In this task, you will import an unmanaged solution to your environment. This contains a small PowerApps model-driven app that we will use later.

    1. In a new tab, navigate to https://make.powerapps.com/ and make sure you have your development environment selected.

    1. Select Solutions and click Import.

    1. Click Browse, select the ContosoBase solution located in the lab resources folder and click Open.

    1. Click Next.
    2. Click Import.
    3. Wait for the import to complete and click Publish All.

    1. Wait for the publishing to complete and click Close.
    2. Click to open the imported solution Contoso Base.

    1. You should have model-driven Customers App, a sitemap for the application, and a web resource.

     

    Task 3: Import Canvas Application

    In this task, you will import a canvas application into your environment. We are doing this using the old standalone import capability that doesn’t use solutions so we can bring in a canvas app that isn’t solution aware and then show you how to make it solution aware.

    1. Select Apps and click Import Package.

    1. Click Upload.

    1. Select the Accounts app located in the lab resources folder and click Open.

    1. Click Import.

    1. The app package should import without errors. Click Open App.

    1. You will be asked for permission, click Allow.

    1. The app designer should open, and your accounts list should show data.

    1. Close the app designer browser tab/window.

     

     

    Exercise 2 – Build Solution

    In this exercise, you will start building your new solution. The first step is to create a publisher and the actual solution container.

    Each solution is linked to a solution publisher. The solution publisher provides information about how to contact the publisher as well as customization prefix value. When you create things like an entity that prefix is part of the name to keep it unique. For example, Contoso might use a prefix of contoso, and if they created a new entity named Project, the logical name would be contoso_project. This ensures that if another app is installed that also has an entity named Project, it won’t collide with others.

    High-level tasks

    Task 1: Create a solution and a publisher, both named Account Project Tracker. The publisher prefix should be set to apt. Add the following existing components:

    • Model-driven app Customers App
    • Customers App sitemap
    • Account entity and Account form.

    Task 2: Add a new entity with the name Project

    • New fields to the Project entity.

     

    Task 1: Create Solution

    In this task, you will create a publisher and a new solution.

    1. Navigate to https://make.powerapps.com/ and make sure you in your development environment.
    2. Select Solutions and click New
      Solution.

    1. Enter Account Project Tracker for Display Name and click on the Publisher dropdown.

    1. Select + Publisher.

    1. Enter Account Project Tracker for Display Name, enter apt for Prefix and click Save and Close.

    1. Click on the Publisher dropdown and select the publisher you created.

    1. Enter 1.0.0.0 for Version and click Create.

    1. Click to open the solution you created.

    1. Next, we are going to add the existing model-driven app into our empty solution. Click Add Existing | App | Model-Driven App. Add Existing is how you bring in assets that already exist and associate them with your current solution container.

    1. Select the Customers App and click Add.

    1. Click Add Existing again and select Other | Site Map. Model-driven apps also use a site map to define navigation, and this is a separate component. We are bringing this also into the solution, so we have all our dependencies of the app. You could also do this by selecting the model-driven app and clicking add required components.

    1. Select Customers App sitemap and click Add.

    1. Click Add Existing | Other | Web resource.

    1. Select Show Name and click Add. If needed, you can search for the web resource in the search bar in the upper right-hand corner of the window.

    1. Click Add Existing and select Entity.

    1. Select Account and click Next.

    1. Click Select Components. By default, when you add existing of an entity any of the fields, forms and views are not referenced. That is a good thing as it means you don’t have dependencies on those items. If you wish to change any of the existing fields, forms, or views, you can use the Select components to associate them along with the entity to your solution. Notice there is also an Include all components. This should not be used when adding existing entities that managed by other solutions like Account. It should only be used for new entities that have been created as unmanaged in this environment.

    1. Select the Forms tab.
    2. Select the Account form and then click Add.

    1. Click Add again.

     

    Task 2: Add new entity to the solution

    In this task, you will add new Project entity to the solution.

    1. Click + New and select Entity.

    1. Enter Project for Display Name and click Create.

    1. Make sure the Fields tab is selected and click Add Field.

    1. Enter Start Date for Display Name, select Date Only for Data Type, make the field Required, and click Done.

    1. Click Add Field again.
    2. Provide the information below and click Done.

    1. Click Add Field one more time.
    2. Provide the information shown in the image below and click Done.

    1. Click Save Entity in the lower right corner
    2. Select the Relationships tab.
    3. Click Add Relationship and select Many-to-One.

    1. Select Account for Related Entity and click Done.

    1. Click Save Entity.

    1. Select Account Project Tracker and click Publish All Customizations.

    1. Wait for the publishing to complete.

     

    Exercise 3 – Deploy the solution

    In this exercise, you will be exporting your solution from the development environment and importing it into the production environment.

    You will export both an unmanaged solution and a managed solution. The unmanaged solution is for if you need to re-create your development environment in the future. The managed solution is the solution you will import into production. You should always have a matching unmanaged solution anytime you export a managed solution.

    High-level tasks

    Task 1: Run solution checker and correct any issues found.

    Task 2: Export solution, both managed and unmanaged. Deploy the managed solution to production.

    Task 3: Test your work in the production environment.

    Task 1: Verify solution using Solution Checker

    • Select the Account Project Tracker solution you created and click Solution Checker | Run.

     


    1. The Solution Checker should start running.


    1. Wait for the Solution Checker to complete checking your solution.


    1. Select the solution and click Solution Checker | View Results.


    1. You will get issues related to the web resource you created. Expand the issue.


    1. You will get more information on the issues including the severity, category, and statement.
    • The first error is telling us to not ship web resources with debug script like console.log.
    • The second error is caused by the usage of deprecated API xrm.page.
    • The third is telling us to use strict mode.

    You will fix these errors next.


    1. Select Solutions and open Account Project Tracker solution.
    2. Click to open the Show Name web resource.


    1. Click Text Editor.


    1. You worked with the developer of the code, and they provided you an update. Replace the function with the snippet below and click OK.

    function onload(executionContext)

    {

        “use strict”;

    var formContext = executionContext.getFormContext();

    var name = formContext.getAttribute(“name”).getValue();

    }


    1. Click Save.
    2. Click Publish.
    3. Close the solution explorer.
    4. Click Done.
    5. Select Solutions.
    6. Select Account Project Tracker and click Solution Checker | Run.
    7. Wait for the Solution Checker to complete the check.
    8. Click on the … More Commands button and click Solution Checker | View Results.


    1. You should not get any errors.
    2. Select Apps and click to open the Solution Health Hub.


    1. Select Analysis Jobs. You should see the results of the solution checks you ran.


    1. Click to open the result from the first solution check.


    1. The sub-grid will list all the errors. Double click on the Xrm.Page message.


    1. You will get more information about the result.


    1. Close the Solution Health Hub application.

     

     

    Task 2: Deploy solution

    It this task, you will export the solution you created and import it into your “prod” environment.

    1. Make sure you are in your Dev environment and select Solutions.
    2. Select Account Project Tracker solution and click Export.

    1. Click Next.

    1. Make sure Unmanaged is selected and click Export.

    1. Save the solution to your computer.
    2. Export the solution again and this time export as Managed. Notice the solution version has incremented for the second export.

    1. Save the solution on your computer.
    2. Switch to your “Prod” environment (Prod-user00 (orgcc8fibb2)).

    1. Select Solutions and click Import.

    1. Click Browse.
    2. Select the managed solution you exported and click Open.

    1. Click Next.
    2. Click View solution package details.

    1. You can review what is included in the import. Close this window.

    1. Click Import.
    2. Wait for the import to complete and click Close.
    3. Click to open the solution you imported.
    4. Make sure all the components you added are listed.

     

    Task 3: Test Deployed Solution

    In this task, you will test the app in the solution.

    1. Navigate to https://make.powerapps.com and make sure you are in your “Prod” environment.
    2. Select Apps and click to open the Customers App.

    1. Change the view to All Accounts. Accounts should load.
    2. Select Contacts, change the view to show All Contacts and the contacts should load.
    3. Click New.

    1. Enter Test for Last Name, enter your personal email for Email and click Save.

    1. Close the model-driven app browser tab.

    Exercise 4: Update, Patch, and Upgrade

    In this exercise, you will use the patch and upgrade features of Solutions. Patches allow transporting only the changes you make. For example, if you fix the length of a field, you would add the entity and just that field to the patch solution and then that would be all you transport to production. Patches do require the initial release solution to be installed in order to install a patch.

    You got the feedback below:

    User doesn’t always have the Start and End Date of projects and needs to be able to create projects without these fields.

    Note: In the interest of time, we have not included steps about unit testing your work and changes. In real-world implementations it’s always important to test as you go, even for the smallest of changes.

    High-level tasks

        Task 1: Clone a patch and remove the requirement for Start and End Date fields.

        Task 2: Import the patch to production.

        Task 3: Clone solution, remove field, add your canvas app, and export solution.

        Task 4: Import cloned solution to production.

    Task 1: Clone Patch

    In this task, you will create a “clone a patch” solution and remove the requirement for Start Date and End Date of the Project entity.

    1. Navigate to https://make.powerapps.com/ and make sure you are in your Dev environment (Dev-user00 (orgcc8fibb2)).
    2. Select Solutions and click to open the Account Project Tracker solution.
    3. Click on the button and select Clone | Clone a Patch. When you do this, your solution is changed to read-only. A new patch solution is created. This patch solution starts out empty, and then you add into it any items you wish to change or create.

    1. The minor version will be incremented for you, change the Display Name to Account Project Tracker Patch and click Save.

    1. You should see a message that will tell you can’t edit the Account Project Tracker solution anymore.

    1. Select Solutions and click to open the patch solution.

    1. Click Add Existing and select Entity.

    1. Select the Project entity and click Next.

    1. Click Select Components.

    1. Select Start Date and End Date fields and click Add.

    1. Click Add again.

    1. Click to open the Project entity.

    1. Open the End Date.

    1. Remove the requirement and click Done.

    1. Open the Start Date.

    1. Remove the requirement and click Done.

    1. Click Save Entity.

    1. Select Solutions and click Publish All Customizations.
    2. Wait for the publishing to complete.
    3. Select the Patch solution and click Export.

    1. You will be prompted to publish and/or run solution checker. You can if you wish.

    1. Click Next.
    2. Select Managed and click Export.

    1. Save the Patch solution on your computer.

     

    Task 2: Import Patch Solution

    In this task, you will import the Patch solution into your “Production” environment.

    1. Navigate to https://make.powerapps.com/ and switch to your “Production” environment (Prod-user00 (orgcc8fibb2)).
    2. Select Solution and click Import.

    1. Click Browse.
    2. Select the managed Patch solution you exported and click Open.

    1. Click Next.
    2. Click Import.
    3. Wait for the import to complete and click Close.
    4. Your “Production” environment will now have the initial solution and the patch solutions. Click to open the Patch solution.

    1. You should only have the components you added to Patch solution. Click to open the Project entity.

    1. You should have only the two fields you added to the solution.

     

    Task 3: Clone Solution

    When you are ready to create the next version of your solution and are done patching the current version, you clone the solution to create the next version. This combines all patches back into the base solution file and makes the base solution file editable for you to build your next version of the solution. After being combined with the base solution, all patches are removed, and you are left with only the base solution.

    You realized the Cost field in no longer needed because it is roll-up field from tasks that will be added in future date.

    You also now know that you can include your canvas app in your solution and move it through your ALM process at the same time.

     

    1. Navigate to https://make.powerapps.com and make sure you have your Dev environment selected.
    2. Select Solutions.
    3. Click on the button of Account Project Tracker solution and click Clone | Clone Solution.

    1. The Version will be incremented for you, click Save.

    1. The two solutions will be combined, and your Dev environment will now have just one Account Project Tracker solution.

    1. You will now delete the Cost field from Project entity. Open the Account project Tracker solution.
    2. Click to open the Project entity.

    1. Locate the Cost field, click on the … button and click Delete. When you delete a field of type currency, you only delete the input field. The reference to base currency will automatically also delete on save.

    1. Click Save Entity. With this type of change a publish of customizations is not required for the changes to take effect.
    2. We will now add our canvas app to the solution to prepare it for transport to the production environment. While still viewing your Account Project Tracker solution, click Add Existing and select App | Canvas App.


    1. Select Outside solutions


    1. Select the Accounts App and click Add. This will take a moment to load. You may want to refresh the hosting browser after a minute to test if is there.
    2. Select Solutions and click Publish All Customizations.
    3. Wait for the publishing to complete.


    1. Select Solution, click on the … button of Account project Tracker and select Export.

    1. Click Next.
    2. Select Managed and click Export.

    1. Save the solution on your machine.
    2. Export the solution again but select Unmanaged this time.
    3. Save the solution on your machine.

     

    Task 4: Import the Clone Solution

    1. Navigate to https://make.powerapps.com/ and make sure you are in your “Production”. Environment.
    2. Select Solutions and click Import.
    3. Click Browse.
    4. Select the managed solution you just exported and click Open.

    1. Click Next.
    2. The import wizard will recognize the solution as an update. Click Next.

    1. Click Import. Notice the Stage for upgrade is checked. This is enabled any time you have patches already installed. It allows the new version to be imported and then when you click apply the old versions of the patches are removed and any destructive changes like removing fields and entities are completed and then finally the old solution is removed, and the new staged one is renamed the same as the original solution file.

    1. Click Apply Solution Upgrade.

    1. Click Close.

    1. The solutions in your “Production” environment will be combined, and you will have just one solution with version 1.1.x.x. Click to open Account Project Tracker.

    1. Click to open the Project entity.

    1. The Cost field should be deleted from the solution.

    1. Navigate to Apps.
    2. Select Apps and click to play the Accounts App.

    1. You will be asked for permission, click Allow.
    2. Accounts list should load, click on one of the accounts.

    1. Details of the account will load.

    1. Close the canvas app browser window.
    Comments