Double Click to Call Skype in Dynamics CRM 2011

Paul Nieuwelaar, 14 July 2011

In Microsoft Dynamics CRM 2011 you have the ability of setting a field’s type to ‘URL’, which means that when you are viewing a record, the URL field will display like a link with blue text and underlined. When you double click on this field it will open a new window displaying the webpage. This functionality is also available for fields of type ‘Email’, in that when you double click on the field it will open a new email message to that person.

Double Click to Call Skype in Dynamics CRM 2011

I have decided to create a simple JScript function that will work in the same way as a URL or Email field, so that when you double click on a Skype field it will open a new Skype call to that person. For this example we will add the Skype field to the Contact form, so we can easily double click their Skype name to contact them.

To configure this functionality on any field you will first need to create a new field to hold the Skype Name. This should just be a standard ‘Single Line of Text’ field. Then add this field to your form.

Double Click to Call Skype in Dynamics CRM 2011 

Next you need to Create a new Web Resource to hold the JScript Function. Call this Web Resource something like ‘skypeCall’, and then paste the following JScript into the Text Editor:

function skypeCall(skypeField) {
    var skype = document.getElementById(skypeField);
    skype.style.textDecoration = "underline";
    skype.style.color = "blue";
    skype.ondblclick = function () { if (skype.value != null && skype.value != "") { window.open("callto://" + skype.value); } };
}

You will then need to call this function from the forms OnLoad event, and also the Skype field’s OnChange event.  For both the OnLoad and OnChange Event Handlers you will need to set the function name, which is ‘skypeCall’, and the Parameters, which is the schema name of the Skype Name field in quotation marks, in this case for example “new_skypename”. 

Double Click to Call Skype in Dynamics CRM 2011 

Finally you can Save and then Publish your form and test the field is working correctly. As soon as you start entering something into the Skype Name field you will notice the blue underline effect on the field, and you will instantly be able to double click the field to open a new Skype call.

This function can be used on as many different fields as you want, all you need to do is specify the Skype Name field each time in the event handler properties of the OnLoad and OnChange event.

If the call doesn’t open in skype by default, you will need to make sure that Skype is configured to open callto: links. Skype sets this option by default, however if it is not set you can open your Skype Options and view Advanced Settings to ensure that it is checked.

 Double Click to Call Skype in Dynamics CRM 2011

When you open the links now they should open in Skype.