A Dynamics 365 local message listener for web client notifications - part 1

One problem that comes up from time to time on Dynamics 365 Customer Engagement projects is how to receive notifications from an application running on a user's local PC. Although the Unified Service Desk (USD) interface supports a variety of ways for Dynamics 365 to interact with local applications, the out-of-the-box web interface does not. Today, I will present an approach that uses something similar to the Dynamics 365 USD generic listener adapter.

The USD generic listener adapter is essentially just a lightweight web server that runs on the local workstation. When it receives GET requests with certain query string parameters, it raises events in the USD application that trigger various predefined actions. It was originally intended for testing CTI configuration in USD, and although Microsoft officially calls it a "testing tool," it's actually an easy-to-use (and free) component that you can use to trigger all sorts of automations in USD.

A web client message listener

My approach to a message listener for the web client also uses a lightweight web server built in C# that runs on the local workstation. When an application wants to pass a message to Dynamics 365, it can post a JSON object to the listener, where it will be queued for later retrieval by custom JavaScript code in Dynamics 365. When the queued messages are retrieved from the listener, they are also purged from the queue so each request returns only new messages.

Here's what the JSON objects look like:

      "data":"MESSAGE TO PASS TO CRM . . ."


  {"data":"MESSAGE FOR CRM 1"},
  {"data":"MESSAGE FOR CRM 2"},
  {"data":"MESSAGE FOR CRM 3"}

Once the messages are retrieved in Dynamics 365, they can be processed however you like. In my next post, I'll show the code to make the approach work. Until then, happy coding!

comments powered by Disqus