0

Advance warning: Im an absolute newbie to Dynamics CRM!

Intention

I want to have a feature like Lync/Skype integration but use my own URL. (Click on any telephone number inside CRM and call it).

For eg. assuming I have a web service which can initiate a call per URL: http://telephony.com/call?nr=012345678. Now, whenever a CRM user clicks onto a telephone number field (in forms and views) inside the CRM my web service should be called instead of Skype/Lync.

In fact I'm trying to reproduce sth. like the InGenius Connecter.

Attempts

I already tried to inject a JS web resource to a specific formular (in my case it was the default contact form) and override the Mscrm.ReadFormUtilities.openPhoneClient callback (which seems to handle the Lync/Skype integration).

function load() {
    // override integrated CTC (Lync/Skype)
    Mscrm.ReadFormUtilities.openPhoneClient = function (telephoneNr) {
        // redirect user to my web service
        window.location.replace("http://telephony.com/call?nr="+telephoneNr);
        return; 
    }
}

Found this method at: Disable Lync completely

This does work well in forms of Dynamics 2015 (my custom link pops up instead of Skype/Lync). However, this does only work on entity forms since I can't inject web resources into an entity view.

My other ideas how to implement such a feature are:

  1. Inject global JS resource which disables Lync/Skype and encapsulate every telephone number with link to my custom URL.
  2. Extend/Manipulate Lync/Skype integration to use my custom URL instead of Lync/Skype.
  3. Write plugin which encapsulate telephone numbers server side.

Question

Since I have a grasp understanding of Dynamics and no experience in plugin/resource development, I'm left a bit confused with these questions.

  1. Is it possible to achieve any of the three ideas above ?
  2. If not, any idea how InGenius solved this problem ?
  3. Do you have any other idea/resources about this topic ?
Community
  • 1
  • 1
DevilsJin
  • 109
  • 1
  • 13
  • I've the same intention using CRM 2016. I've followed the Disable Lync Completely instructions, but can't seem to get it to work. It seems that Mscrm.ReadFormUtilities is undefined during OnLoad. Did you run into this at all? – Mark De Verno May 20 '16 at 14:49
  • @MarkDeVerno Where do you inject your code ? If you use the form assets (aka Web Scripts for Forms) then it may possible that Mscrm.ReadFormUtilities is out of your scope. (This happened to me cause these form scripts are loaded in a different frame - dont know if this still applies to 2016). Check if the Mscrm is initialized or existant, if its not use a hack to get all window/frame objects and check if Mscrm is initialized there. If it still isnt, I would guess that Mscrm.ReadFormUtilities doesnt exist anymore in 2016 and you would need to debug the JS to find the correspondending feature. – DevilsJin May 23 '16 at 11:10
  • I went to Settings -> Customize System -> Entities ->Contact -> Forms -> Contact -> Form Properties and added JS to the event list and handlers. I'm very new to CRM development, but this seemed like the right place based on the above. While debugging, Mscrm.ReadFormUtilities does not seem to be initialized when the script is executed during OnLoad. However, I can see it, as well as Mscrm.Shortcuts.OpenPhoneWindow (?client) later on, in other scripts. Is this where you put your code? Or should I be doing this elsewhere? – Mark De Verno May 23 '16 at 17:08
  • You can place your JS right there, but you would need to get the parent frame object in order to use Mscrm properly (the forms are devided in frames and therefore have different scopes). Actually, this is quiet simple: Just do a quick search which scope does have the complete `Mscrm` class and write a JS function which gets its window element, and use that instead of the 'current' one. I will post a snippet tomorrow how I solved this issue in CRM 2011 (should still work in 2016 with a little hack). Note that there isnt ANY support from Microsoft doing this ! – DevilsJin May 23 '16 at 22:28
  • 1
    Here is a JS Fiddle for custom click-to-call on the Contacts form: https://jsfiddle.net/odLu5z0e/. It follows the original JS handler, including logging the activity. Just implement the method as required. – Mark De Verno May 26 '16 at 18:20
  • @Mark De Verno: window.parent.Mscrm.ReadFormUtilities.openPhoneClient = function(){return;}; did the trick. thanks for pointing to the correct Mscrm :) – Tobias Koller Jun 27 '16 at 07:49

1 Answers1

0

Currently I found two options available to achieve a custom CTC feature. (Both has the downside of not being officialy supported by the dynamics crm.)

Global Ribbon

Pretty simple: Add a Click-To-Call button to global ribbon which is only enabled on specific grids when one row is selected. This button refers to an JS-Action which retrieves the telephone number via ODATA and then launches the dial process.

Global Ribbon CustomRule injection

Add a global button to ribbon which refers to a JS resource per <CustomRule>. The JScript then unbinds all actions from links with .ms-crm-Phone classes and replaces its href-attribute.

This would be useful if one want to override the integrated "Skype / Lync - Click to Dial" feature with his own logic.

I didn't test this method until now, so I can't guarentee it's working !

Note: I will include example scripts as soon I got the time.

DevilsJin
  • 109
  • 1
  • 13