Home > CRM, Microsoft Dynamics > Microsoft CRM: queue gadget

Microsoft CRM: queue gadget

Microsoft CRM 3.0 shipped with an extensive web service API that can be used by various types of applications. I’ve provided a sample Windows sidebar gadget (or just gadget) that retrieves queue items related to the currently logged in user every predefined interval. Feel free to use this as a starting point for your coding efforts. Since the gadget is always available on the desktop but small in size, the ideal information to display on gadget should be something dynamic and concise. In Microsoft CRM context, the queue item entity fits squarely as it is changed quite frequently and requires immediate attention from a user.

image

Figure 1 “In progress” queue items

image

Figure 2 “Assigned” queue items

image

Figure 3 Settings window

Developing CRM Gadget

For more information about developing gadget in general, please refer to MSDN article in the resource section. This article will focus more on CRM specific aspects.

Retrieving data from CRM

Gadgets are composed of HTML and JScript. We can use XmlHttp from JScript to send hand crafted SOAP message to the CRM server. Then we use an Msxml2.DOMDocument to parse the response to get the result. We need not do it asynchronously as the user is not blocked by the gadget anyway and it will be much more complicated to do it asynchronously.

In keeping with best practices, this sample retrieves only columns that are needed to reduce server load.

Reading and writing settings through the gadget infrastructure

The gadget infrastructure provides a nice API for reading and writing settings. Be careful about storing sensitive information though. In this case, we just store the CRM server name, polling interval, and queue type so we are okay.

For reading settings

var currentServerName = System.Gadget.Settings.readString(“crmServerName”);

For writing settings

var temp = serverName.value;

System.Gadget.Settings.writeString(“crmServerName”, temp);

Securing gadget

Gadgets also subject to all sorts of cross site scripting vulnerabilities, since they are also web applications. All user input should be validated before using it. All external data (including data from the CRM server) must be properly encoded before rendering.

Using standard style sheet

This sample utilizes template.css to make the gadget look consistent with the CRM web application. For example the server name label is shown as a required field. This template.css file is shipped with CRM SDK. You can download it from Microsoft.com.

Deploying gadget

Because this gadget is a real application though it looks cute; there will be a time that you will want to patch it after you ship. The best way to enable gadget patching is to deploy it with MSI. However, for simplicity of our sample, I just use the zip approach. All you need to do is zip all HTML, JScripts, CSS, and the manifest (gadget.xml) together and change the resulting file’s extension from .zip to .gadget. Then the user can install it by double clicking.

Resources

– MSDN Windows Sidebar Gadget Development Overview (http://msdn2.microsoft.com/en-us/library/aa965850.aspx)

– System.Gadget.Settings in MSDN (http://msdn2.microsoft.com/en-us/library/ms723661.aspx)

– Other CRM Windows sidebar gadgets

CRM SDK

Akezyt Janedittakarn

Advertisements
Categories: CRM, Microsoft Dynamics
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: