Using PowerApps Portals with Canvas Apps

Loading

Using PowerApps Portals with Canvas Apps

PowerApps Portals and Canvas Apps are powerful tools within the Power Platform that allow organizations to create custom applications for both internal and external users. PowerApps Portals allow users to build websites that are integrated with data from Dataverse (formerly Common Data Service), while Canvas Apps are flexible apps that allow for customized user experiences through drag-and-drop design.

Integrating Canvas Apps into PowerApps Portals enables a seamless user experience where both external users (who interact with the Portal) and internal users (who interact with the Canvas App) can access and manipulate data in real-time. This can be useful when you want to extend the functionality of a Canvas App to be accessed by a broader audience outside the organization, through a web-based Portal.

Below is a comprehensive, step-by-step guide on how to integrate Canvas Apps into PowerApps Portals.


1. Prerequisites

Before you begin, ensure the following prerequisites are met:

Step 1.1: PowerApps Environment

  • Ensure that you have an active Power Apps environment, where both Canvas Apps and PowerApps Portals can be created and managed.

Step 1.2: PowerApps Portal License

  • Make sure that you have a PowerApps Portals license. This will grant you access to create and manage portals for both internal and external users.

Step 1.3: Permissions

  • You will need appropriate permissions to create Canvas Apps and PowerApps Portals. You should be an admin or have a role with permission to create and publish apps.

Step 1.4: Existing Canvas App

  • You need a Canvas App already created. The Canvas App should be designed and tested to ensure it works properly before embedding it in a portal.

Step 1.5: Dataverse (Common Data Service) Setup

  • Ensure that both the Canvas App and PowerApps Portal are connected to the appropriate Dataverse tables (entities). The Portal will pull data from Dataverse, which should also be used in the Canvas App.

2. Create a PowerApps Portal

If you don’t have an existing PowerApps Portal, you need to create one.

Step 2.1: Create a New Portal

  • In the Power Apps portal, go to the Apps section.
  • Click on Create and then select Portal under the options for Power Apps.
  • Choose a Portal Template (for example, Customer Self-Service or Community Portal) based on your needs. You can always customize these templates later.
  • Name the portal and follow the prompts to configure the portal’s settings, such as authentication method (Azure AD, LinkedIn, or local authentication) and default language.

Step 2.2: Set Up Portal Permissions

  • Once the portal is created, configure the necessary security roles and permissions for external users who will be interacting with it.
  • You can also set up custom roles, which will control access to specific features, pages, and data.

Step 2.3: Configure Dataverse Integration

  • Ensure your portal is linked to the necessary Dataverse tables (which are the data sources for your Canvas App). You can configure this under the Power Apps Portal Management.

3. Create and Prepare the Canvas App

Step 3.1: Design the Canvas App

  • Go to Power Apps Studio, click on Create, and choose Canvas App.
  • Choose either a Phone or Tablet layout, depending on the intended design.
  • Design your app using the drag-and-drop interface, connecting the necessary Dataverse tables, other data sources, and controls to display and interact with the data.

Step 3.2: Publish the Canvas App

  • Once the Canvas App is complete and tested, go to File > Save and Publish it.
  • You will need the App ID of the published Canvas App to embed it into the portal.

Step 3.3: Prepare the Canvas App for Embedding

  • The Canvas App must be designed to work effectively within the portal, so ensure it is optimized for a web-based interface (e.g., no excessive use of high-resolution images or heavy components that can slow down performance).
  • You should also ensure that the app is responsive to different screen sizes.

4. Embed the Canvas App into the PowerApps Portal

Once both the Canvas App and the PowerApps Portal are ready, the next step is to embed the Canvas App inside the portal.

Step 4.1: Open the PowerApps Portal Management

  • Go to Power Apps Portal Management and open the portal that you want to modify.

Step 4.2: Create or Modify a Web Page

  • In the Portal Management, go to Pages and either create a new page or edit an existing one where you want to embed the Canvas App.
  • The page you create will be where the Canvas App will appear.

Step 4.3: Add an Embed Code (iFrame)

  • PowerApps Portals supports embedding Canvas Apps through an iFrame. The iFrame allows you to load the Canvas App within the portal page.

To embed the Canvas App:

  1. From Portal Management, navigate to the page where you want the Canvas App.
  2. Choose Add New Web Resource from the options.
  3. Set the Web Resource Type to HTML.
  4. In the HTML Text of the Web Resource, insert the iFrame code that points to your Canvas App.

Example iFrame Code:

<iframe width="100%" height="800px" src="https://apps.powerapps.com/play/{AppId}?tenantId={TenantId}&source=portal"></iframe>
  • Replace {AppId} with the Canvas App ID (which can be found in the app details page).
  • Replace {TenantId} with your organization’s tenant ID.

Step 4.4: Configure Additional iFrame Settings

  • Ensure that the iFrame is set to the correct size and responsiveness for your portal.
  • You may also want to hide the iFrame’s borders and other elements for a clean integration.

5. Passing Data Between Canvas Apps and PowerApps Portals

A common use case is to pass data between the PowerApps Portal and the Canvas App. You can pass data such as record IDs, user information, or other parameters.

Step 5.1: Use Query Parameters in the iFrame URL

  • When embedding the Canvas App in an iFrame, you can pass data using query parameters in the iFrame’s src URL.
  • For example, to pass a record ID or custom data, modify the iFrame URL to include parameters like this:
<iframe width="100%" height="800px" src="https://apps.powerapps.com/play/{AppId}?tenantId={TenantId}&recordId={RecordID}&source=portal"></iframe>

In your Canvas App, you can retrieve these parameters using the Param() function.

Example:

Set(varRecordID, Param("RecordID"))

Step 5.2: Integrate Data in the Canvas App

  • Inside the Canvas App, use the data passed via parameters to fetch records from Dataverse or perform other actions based on that data.

6. Customize and Test the Integration

Step 6.1: Test the Embedded Canvas App

  • After embedding the Canvas App in the portal, test the integration thoroughly.
  • Ensure that:
    • The Canvas App loads correctly in the portal.
    • The data passed from the portal is being correctly used in the Canvas App.
    • The user experience is seamless across both the portal and the Canvas App.

Step 6.2: Debugging

  • If the Canvas App does not load, verify the App ID, Tenant ID, and iFrame URL parameters.
  • Ensure that the Portal’s security roles are set correctly and that the Canvas App is accessible by the intended users.

7. Publish and Share the PowerApps Portal

Once everything is working as expected, you can publish the changes:

Step 7.1: Publish the Portal

  • Go back to Portal Management and save and publish the portal.
  • The portal will be live, with the embedded Canvas App available for users.

Step 7.2: Share the Portal

  • Share the portal with the intended users by providing them with the portal’s URL. You can control access to the portal using security roles and authentication mechanisms.

8. Ongoing Maintenance and Optimization

After the integration is live, ensure ongoing maintenance:

Step 8.1: Monitor Usage

  • Use Power Platform Analytics to monitor how users are interacting with the portal and Canvas App. Ensure that performance metrics like load times and interaction times are optimal.

Step 8.2: Make Updates as Necessary

  • Based on feedback and usage, make adjustments to the Canvas App or the PowerApps Portal.
  • Update the Canvas App if there are any changes to the data model or user requirements.

Conclusion

Integrating Canvas Apps into PowerApps Portals is a great way to extend your internal applications to external users, providing them with a customized, data-driven experience. By following the above steps, you can successfully embed Canvas Apps in PowerApps Portals, allowing seamless interaction with your Dataverse data and enhancing the user experience.

Let me know if you have any further questions or need help with any of the steps!

Leave a Reply

Your email address will not be published. Required fields are marked *