Click to Call Lync from Dynamics CRM 2011 Forms

Paul Nieuwelaar, 31 October 2011

In my previous post on Click to Call from Dynamics CRM 2011 Grid views with MS Lync, I showed how easily Lync can be used to call your contacts from Dynamics CRM grid views with an easy to use ‘click to call’ feature. In this post I will be showing another handy ‘click to call’ method for Dynamics CRM 2011 and Lync, which is to add some JScript to your contact form to allow the phone number fields to be clickable, allowing you to call a contact directly from the form using Lync.

Click to Call Lync from Dynamics CRM 2011 Forms 

To enable this functionality on any phone number fields in Dynamics CRM 2011, we can simply use the same method described in a previous blog post of mine: Double Click to Call Skype in Dynamics CRM 2011. Using this same method, we can change the ‘callto://’ part of the JScript to ‘tel:’ – which will dial from Lync instead of Skype. Create a Web Resource, and then paste in the modified JScript. - You can use the following JScript, which has been modified to work with Lync, rather than Skype:

function callLyncNumber(phoneFieldName) {
    var phoneField = document.getElementById(phoneFieldName);    
    phoneField.style.textDecoration = "underline";
    phoneField.style.color = "blue";
    phoneField.ondblclick = function () { if  (phoneField.value != null && phoneField.value != "") { window.open("tel:" + phoneField.value); } };
}

Once your Web Resource has been created, you can call this function for as many phone number fields as you like. Simply call the function once for each field from the forms onLoad, and pass in the phone number field as a parameter.

Click to Call Lync from Dynamics CRM 2011 Forms 

This can be quickly added to all the phone number fields on your Contacts, Accounts and Leads, as well as the phone number field on the Phone Call activity entity, to make contacting your customers even easier.

Finally, the end result:

Click to Call Lync from Dynamics CRM 2011 Forms