Skip to main content
Community site session details

Community site session details

Session Id :
Customer Service forum

Global Listener (message) exists, but not being called

(0) ShareShare
ReportReport
Posted on by

In our Dynamics CRM integration, we are loading WebResource, containing JS code. In this code, we create eventListener to get events from an iframe.

Since we need to open side panel (Xrm.Panel.loadPanel) from most of screen in CRM, we've added a button to most of ribbons, that load our web resource and in this web resource we register event listener, like this:

if (!window.top.psdcMessageListener) {
    window.top.psdcMessageListener = function(event) {};
    window.top.addEventListener('message', window.top.psdcMessageListener, false);
    console.log("PSDC: Added event listener");
};

Everything works fine and we receive the event, until we run the code for a second time (e.g. opening account or activity) - now we still have our listener in Global Listeners of Chrome, but now it just doesn't fire at all.

There are other listeners for 'message' event, that are coming with CRM such as Crossdomain.js or sdk.js and they appear in the same list of Global Listeners, and working fine.

Is there any way to fix it / to see why it's not being called? Or alternatively, is there is a way to load web resource globally once per load of Dynamics CRM window?

Thanks.

Categories:

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

News and Announcements

Now Available: 2025 Release Wave 2

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Customer Service

Featured topics

Product updates

Dynamics 365 release plans