Loading...

Debugging Canvas App PCF components with fiddler

Debugging Canvas App PCF components with fiddler

Those of you who know me will also know that I am a massive Fiddler fan for removing the need to deploy each time you change your JavaScript source.

Here are some of my previous blog posts on Fiddler - http://develop1.net/public/search?q=fiddler

The PowerApps docs now even include instructions on it https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/streamline-javascript-development-fiddler-autoresponder

Developing PCF Canvas Controls

When developing PCF controls for Canvas Apps, the process is slightly different and includes an extra step.

1. Add an autoresponder in the format:

Resources0Controls0<NamesSpace>.<ControlName>.bundle.js?sv=
E.g. Resources0Controls0Develop1.PCFTester.bundle.js?sv=

It should look something like:

2. Since the scripts are served from a different domain to PowerApps, configure Fiddler to add the Access-Control-Allow-Origin header.

In fiddler, Press Ctrl-R to open the rules editor.

Locate the OnBeforeResponse function and add:

if (oSession.oRequest.headers.Exists("Host") && oSession.oRequest.headers["Host"].EndsWith("windows.net")) {
  if (oSession.oResponse.headers.Exists("Access-Control-Allow-Origin")){
    oSession.oResponse.headers["Access-Control-Allow-Origin"] ="*";
  }
  else{
    oSession.oResponse.headers.Add("Access-Control-Allow-Origin","*");
  }
}

It should look something like:

 

When you add in your PCF Component to the Canva App, it should now be loaded from your local file system just like it does with Model Driven Apps. To refresh the component, you will need to exit the app and re-open (rather than just refresh the window in Model Driven Apps).

Hope this helps,

@ScottDurow

Published on:

Learn more
Develop 1 - Dynamics 365 Architecture Services
Develop 1 - Dynamics 365 Architecture Services

Share post:

Related posts

How to access multi-level hierarchical parental table columns in canvas app gallery

Learn How to access multi-level hierarchical parental table columns in canvas app gallery. Use Dot Operator to access. WAtch full video here. ...

3 days ago

Paging in Gallery in Canvas App Power Apps

You can easily implement paging concept for your gallery in canvas APP. follow below steps to achieve this. watch full video here or read the ...

4 days ago

Paper to Power App: Creating a Canvas App in D365 CRM from a Hand-Drawn Sketch

Power Apps, known for its low-code/no-code capabilities, now offers the ability to create complete apps from an image. Sometimes, the best way...

7 days ago

Integrate Your Custom Copilot into Your Canvas App in Power Apps

Microsoft Copilot Studio allows creators to build tailored Copilots powered by AI effortlessly. In a few simple steps, you can implement your ...

28 days ago

Dynamics 365 Embedded Canvas Apps in Model-Driven Power Apps

Introduction In an era where business evolves at lightning speed, leveraging the latest technology is crucial for success. Dynamics 365,…...

1 month ago

Use Copilot to quickly filter, sort, and search canvas app galleries with SQL Server

We are excited to announce that Power Apps application runtime users can now use Copilot to quickly filter, sort, and search the items in canv...

1 month ago

Canvas App | Simplified Display of SVG Images

In one of my previous articles : Display an SVG icon in CanvasĀ App ,I explained how to display an SVG icon using an Image control. While this ...

2 months ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy