Search This Blog

Friday, June 23, 2017

Click phone number in CRM automatically call go in Skype or Skype for Business

Click phone number in CRM automatically call go in Skype or Skype for Business
Whenever click the skype icon or phone number, we want to call automatically through skype for business or skype.




There are two ways we could achieve it
1)Default CRM method call
2)Using javascript

1) Default CRM method call

Code:

Mscrm.Shortcuts.openPhoneWindow('789-852-987','+1','true');

Output:


 Behind the code  "Mscrm.Shortcuts.openPhoneWindow" in CRM

openPhoneWindow = function (phoneNumber, countryCode, useSkypeProtocol) {
    var $v_0 = "tel";
    $v_1 = (new parent.Mscrm.PhoneUriBuilder).buildUri(phoneNumber, countryCode, $v_0),
    $v_2 = parent.Mscrm.CrmUri.createForOrganization($v_1, null);
    $v_2.checkParamsNoEqual = true;
    safeWindowOpen($v_2, "", "")
};
function safeWindowOpen(url, name, features, replace, disablePopupWarning) {
    var $v_0 = null;
    //if (!IsNull(url))
    $v_0 = url.toString();
    //  else $v_0 = "";
    //if (IsNull(features))
    features = "";
    parent.Mscrm.PerformanceTracing.write("Navigate", $v_0);
    var $v_1 = null;
    try {
        if (parent.Mscrm.CrmWindow.$3C && parent.Mscrm.Utilities.isChrome()) features = $7x(features, "status=1");
        parent.Mscrm.CrmWindow.$3C = true;
        var $v_2 = new Date;
        if (window.name === name)
            //The below line of code only open skype window.....
            $v_1 = parent.masterWindow().open($v_0, name, features, replace);
        else
            $v_1 = window.open($v_0, name, features, replace);
        attachErrorHandler($v_1);
        try {
            $v_1.focus()
        } catch (e) { }
        var $v_3 = new Date;
        $9p($v_1, $v_2.getTime(), $v_3.getTime());
        $v_1._masterWindow = masterWindow()
    } catch ($$e_9) { }
    //IsNull($v_1) && !disablePopupWarning && handlePopupBlockerError($v_0);
    return $v_1
}

function Test() {
    openPhoneWindow("768-555-0156", "+91", "false")
}
 

2) Using Javascript:

Code:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
    <script type="text/javascript" src="http://www.skypeassets.com/i/scom/js/skype-uri.js"></script>
<body>
    <a href="tel:23456789">Call</a>
</body>
</html>

Output:



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.