web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to integrate with ...
Power Apps
Unanswered

How to integrate with the msw Service Worker

(0) ShareShare
ReportReport
Posted on by

Hello Everyone, I hope you are doing well.

 

I`m trying to intercept requests in Dynamics365 using the MSWJS library. 

I would be very grateful if anyone did smth similar and could suggest if it is possible to register a Service Worker and intercept requests in D365.

 

It`s what I did (I succeeded to intercept a request from HTML WebResource but can`t intercept a request from JavaScript WebResource):


I uploaded as WebResources 4 separate files:

  • mockServiceWorker.js
  • JS file (packed with webpack), which registers mockServiceWorker and my handlers. And also register the simple react app for the next HTML web resource.
  • HTML file.
  • another JavaScript file that will just make requests on form events.

I added HTML WebResource to the form. It references the file that registers the ServiceWorker like this:

<script src="../scripts/TestMockServiceWorker.js"></script>
 

On the form on load, I have in the Console the following message:

 [MSW] Mocking enabled.
 Documentation: https://mswjs.io/docs
 Found an issue? https://github.com/mswjs/msw/issues
 Worker script URL: 
 https://org___crm.dynamics.com/%7b638496017200000228%7d/webresources/publisher_mockServiceWorker.js
 Worker scope: https://org6eb79fb6.crm.dynamics.com/%7b638496017200000228%7d/webresources/

 

So when I call the request from the react button from this HTML webResource component, ServiceWorker works as expected.

But when I try to make the same request from another JavaScript WebResource - it doesn`t.

 

Could you tell me please if anyone ever tried to integrate Dynamics 365 with Service Worker and suggest how to do this? Is it possible to integrate MSW with Dynamics 365?

How do I need to register ServiceWorker to make it intercept requests from my JS WebResources? (Ideally not only from JS Web Resources but for this I will need to register it in the root. And I think it`s not possible in D365)

 

Thank you in advance

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 76 Most Valuable Professional

#2
Haque Profile Picture

Haque 69

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard