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.
- 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.
- Click Get it Now.
- Click Continue.
- If you agree, accept the terms and conditions, select your dev environment and click Agree.
- 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)
- You may close the browser tab. The installation will continue in the background.
- 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.
- In a new tab, navigate to https://make.powerapps.com/ and make sure you have your development environment selected.
- Select Solutions and click Import.
- Click Browse, select the ContosoBase solution located in the lab resources folder and click Open.
- Click Next.
- Click Import.
- Wait for the import to complete and click Publish All.
- Wait for the publishing to complete and click Close.
- Click to open the imported solution Contoso Base.
- 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.
- Select Apps and click Import Package.
- Click Upload.
- Select the Accounts app located in the lab resources folder and click Open.
- Click Import.
- The app package should import without errors. Click Open App.
- You will be asked for permission, click Allow.
- The app designer should open, and your accounts list should show data.
- 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.
- Navigate to https://make.powerapps.com/ and make sure you in your development environment.
- Select Solutions and click New
Solution.
- Enter Account Project Tracker for Display Name and click on the Publisher dropdown.
- Select + Publisher.
- Enter Account Project Tracker for Display Name, enter apt for Prefix and click Save and Close.
- Click on the Publisher dropdown and select the publisher you created.
- Enter 1.0.0.0 for Version and click Create.
- Click to open the solution you created.
- 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.
- Select the Customers App and click Add.
- 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.
- Select Customers App sitemap and click Add.
- Click Add Existing | Other | Web resource.
- 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.
- Click Add Existing and select Entity.
- Select Account and click Next.
- 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.
- Select the Forms tab.
- Select the Account form and then click Add.
- Click Add again.
Task 2: Add new entity to the solution
In this task, you will add new Project entity to the solution.
- Click + New and select Entity.
- Enter Project for Display Name and click Create.
- Make sure the Fields tab is selected and click Add Field.
- Enter Start Date for Display Name, select Date Only for Data Type, make the field Required, and click Done.
- Click Add Field again.
- Provide the information below and click Done.
- Click Add Field one more time.
- Provide the information shown in the image below and click Done.
- Click Save Entity in the lower right corner
- Select the Relationships tab.
- Click Add Relationship and select Many-to-One.
- Select Account for Related Entity and click Done.
- Click Save Entity.
- Select Account Project Tracker and click Publish All Customizations.
- 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.
- The Solution Checker should start running.
- Wait for the Solution Checker to complete checking your solution.
- Select the solution and click Solution Checker | View Results.
- You will get issues related to the web resource you created. Expand the issue.
- 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.
- Select Solutions and open Account Project Tracker solution.
- Click to open the Show Name web resource.
- Click Text Editor.
- 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();
}
- Click Save.
- Click Publish.
- Close the solution explorer.
- Click Done.
- Select Solutions.
- Select Account Project Tracker and click Solution Checker | Run.
- Wait for the Solution Checker to complete the check.
- Click on the … More Commands button and click Solution Checker | View Results.
- You should not get any errors.
- Select Apps and click to open the Solution Health Hub.
- Select Analysis Jobs. You should see the results of the solution checks you ran.
- Click to open the result from the first solution check.
- The sub-grid will list all the errors. Double click on the Xrm.Page message.
- You will get more information about the result.
- 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.
- Make sure you are in your Dev environment and select Solutions.
- Select Account Project Tracker solution and click Export.
- Click Next.
- Make sure Unmanaged is selected and click Export.
- Save the solution to your computer.
- Export the solution again and this time export as Managed. Notice the solution version has incremented for the second export.
- Save the solution on your computer.
- Switch to your “Prod” environment (Prod-user00 (orgcc8fibb2)).
- Select Solutions and click Import.
- Click Browse.
- Select the managed solution you exported and click Open.
- Click Next.
- Click View solution package details.
- You can review what is included in the import. Close this window.
- Click Import.
- Wait for the import to complete and click Close.
- Click to open the solution you imported.
- 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.
- Navigate to https://make.powerapps.com and make sure you are in your “Prod” environment.
- Select Apps and click to open the Customers App.
- Change the view to All Accounts. Accounts should load.
- Select Contacts, change the view to show All Contacts and the contacts should load.
- Click New.
- Enter Test for Last Name, enter your personal email for Email and click Save.
- 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.
- Navigate to https://make.powerapps.com/ and make sure you are in your Dev environment (Dev-user00 (orgcc8fibb2)).
- Select Solutions and click to open the Account Project Tracker solution.
- 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.
- The minor version will be incremented for you, change the Display Name to Account Project Tracker Patch and click Save.
- You should see a message that will tell you can’t edit the Account Project Tracker solution anymore.
- Select Solutions and click to open the patch solution.
- Click Add Existing and select Entity.
- Select the Project entity and click Next.
- Click Select Components.
- Select Start Date and End Date fields and click Add.
- Click Add again.
- Click to open the Project entity.
- Open the End Date.
- Remove the requirement and click Done.
- Open the Start Date.
- Remove the requirement and click Done.
- Click Save Entity.
- Select Solutions and click Publish All Customizations.
- Wait for the publishing to complete.
- Select the Patch solution and click Export.
- You will be prompted to publish and/or run solution checker. You can if you wish.
- Click Next.
- Select Managed and click Export.
- 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.
- Navigate to https://make.powerapps.com/ and switch to your “Production” environment (Prod-user00 (orgcc8fibb2)).
- Select Solution and click Import.
- Click Browse.
- Select the managed Patch solution you exported and click Open.
- Click Next.
- Click Import.
- Wait for the import to complete and click Close.
- Your “Production” environment will now have the initial solution and the patch solutions. Click to open the Patch solution.
- You should only have the components you added to Patch solution. Click to open the Project entity.
- 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.
- Navigate to https://make.powerapps.com and make sure you have your Dev environment selected.
- Select Solutions.
- Click on the … button of Account Project Tracker solution and click Clone | Clone Solution.
- The Version will be incremented for you, click Save.
- The two solutions will be combined, and your Dev environment will now have just one Account Project Tracker solution.
- You will now delete the Cost field from Project entity. Open the Account project Tracker solution.
- Click to open the Project entity.
- 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.
- Click Save Entity. With this type of change a publish of customizations is not required for the changes to take effect.
- 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.
- Select Outside solutions
- 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.
- Select Solutions and click Publish All Customizations.
- Wait for the publishing to complete.
- Select Solution, click on the … button of Account project Tracker and select Export.
- Click Next.
- Select Managed and click Export.
- Save the solution on your machine.
- Export the solution again but select Unmanaged this time.
- Save the solution on your machine.
Task 4: Import the Clone Solution
- Navigate to https://make.powerapps.com/ and make sure you are in your “Production”. Environment.
- Select Solutions and click Import.
- Click Browse.
- Select the managed solution you just exported and click Open.
- Click Next.
- The import wizard will recognize the solution as an update. Click Next.
- 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.
- Click Apply Solution Upgrade.
- Click Close.
- 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.
- Click to open the Project entity.
- The Cost field should be deleted from the solution.
- Navigate to Apps.
- Select Apps and click to play the Accounts App.
- You will be asked for permission, click Allow.
- Accounts list should load, click on one of the accounts.
- Details of the account will load.
- Close the canvas app browser window.
AccountsApp_20190528155935.zip