Blog Content
- Problem Statement
- Responsive iFrame PCF Control vs iFrame/web Resources Control
- Requirements
- Setup
- Integration Demo Steps
- References and other useful links
- Contact us
Problem Statement
Out of the box Dynamics 365 (D365) functionality allows you to embed Canvas apps into D365 Model-driven Apps. The documented solution allows you to reverse the order by embedding D365 Model-driven app into a Canvas app. The PCF control used in this document also allows you to display a record based on an ID passed to the Responsive iFrame PCF control, solving a common issue when using iFrame in apps or web sites.
NOTE: The demo in this document is simple to build but can be incorporated into complex scenarios. Control integration and parameter passing is the focus of this document.
Responsive iFrame PCF Control vs iFrame/web Resources Control
Type |
Responsive iFrame PCF Control |
iFrame/web resources Control |
Support Platform |
Available on both Canvas App and Model Driven App |
Only available on Model Driven App Form |
Render |
PCF is rendered as part of the same context and it would load at the same time with native components, so it can give a better user experience. |
iFrame and Web Resources are rendered separate to the form |
Config |
In Model Driven App, Responsive iFrame PCF control can be rendered either as a field control or dataset control which means you are going to replace the textbox or subgrid into something else for visualization. In Canvas App, Responsive iFrame PCF Control can be a standalone control. |
Stand-alone configuration on the Form – bind data with Source |
In general, use of Power Apps component framework and custom pages is encouraged to build configurable, reusable and more tight external integrations.
Requirements
To be able to follow this example you will need:
- Power Platform Environment
NOTE: For demo purposes we recommend importing the solution in a Sandbox or Dev Power Platform environment. - Enable Power Apps component framework for canvas apps for the environment you will be using (Power Platform Admin permissions are required)
IMPORTANT: To use code components inside canvas apps, you must enable the Power Apps component framework for canvas apps on the environment you're using. Open the Admin Center (admin.powerplatform.microsoft.com) and navigate to your environment. Navigate to Settings > Features (under the Product section). Ensure Power Apps component framework for canvas apps is turned On. - Access to Power Apps
- Dynamics 365 (D365) Apps (Or any Model-driven App)
- Download the Responsive iFrame PCF Solution (Responsive iFrame PCF Control)
- Import the Responsive iFrame PFC control (see Setup Section)
Setup
After you download the Responsive iFrame PCF solution (Zip file) import it into your Power Platform Environment.
- Navigate to your Power Platform Environment.
- From the left side select “Solutions”
- From the top menu select the Import button.
- Locate the downloaded zip managed solution and import it.
- After the import is completed, you should see the below solution imported to your environment.
Integration Demo Steps
NOTE: Ensure to review the Requirements section of this blog before starting the below steps.
- Navigate to your Power Apps environment (make.powerapps.com)
- From the left menu select the “+ Create” option.
- Select the “Blank app” from the "Create your App" section.
- From the pop-up locate the “Canvas app” option and select the Create button.
- Give it a name and select the canvas format. In this case we will name it DemoiFramePCF and select the tablet format.
- To start, insert a label and a text box, give then proper text and names, and arrange them as below.
- Importing the Resonsive iFrame PFC control to the Canvas app.
- From the left side click the Tree view icon (See below example image).
- Select the “Components” tab.
- Click the ellipsis “…” next to the “+ New Component” option.
- Select the “Import Component” option.
- From the right flyout select the “Code” tab, locate the "responsiveIframePCFControl" component, select it, and at the bottom press the “Import” button.
Note: If you do not see the “Code” tab your administrator has not enabled the “Power Apps component framework for canvas apps” for the environment. (See Requirements section).
- Once the solution is imported, on the left menu select the “Insert” option, locate the “Code Components” section, and select and drag the “responsiveIframePCFControl” component to your screen.
- Give the control a name and ensure that it fits as the example below.
NOTE: The version of the Responsive iFrame PCF control can be resized using the control properties. - Navigate to your D365 Model-drive app, open a record, and copy the URL (We will use it later in the instructions). In this example we will use D365 Field Service and use a Work Order to display in the iFrame control.
NOTE: Ensure to select a Model-driven app Form that can accept parameters in the query string. - Back in the Canvas app select the "responsiveIframePCFControl" control and locate the “src” property. Paste the URL you extracted from the previous step (Ensure to paste the copied link inside the quotation marks).
- Update the src parameters as below to be able to pass information to the iFrame src and load the correct data based on the ID you entered in the text box.
- At this point you can update the text control (run the app) and put any record ID and the iFrame PFC control, it will load the specific record data (See examples below).
References and other useful links
- Use IFRAME and web resource controls on a form (model-driven apps) - Power Apps | Microsoft Docs
- Power Apps component framework components
- IFRAME component - Power Apps | Microsoft Docs
- Responsive iFrame PCF Control | PCF Gallery
Blog Contacts
Contributor Type |
Resource Name |
|
Author |
Sergio Plascencia Schaefer |
|
Author |
Nghiem Doan |
|
Reviewer |
Sonal Bardia |
*This post is locked for comments