Search This Blog

Tuesday, July 25, 2017

Business Process stage onChange event

You can’t cancel the stage change using code in a handler for this event

//Put the below code in the onload function of the form
Xrm.Page.data.process.addOnStageChange(onStageChange); 


function onStageChange(ExecutionContextObj)
{
debugger;
alert(ExecutionContextObj.getEventArgs().getDirection()) // alerts "next" or "previous"
} 
This onStageChange method gets trigger when you click next or previous button. But it is not triggered when you click the link of the stage.

Thursday, July 13, 2017

Dynamics CRM SSRS report Visual studio version comparision


Panel
Description
Dynamics 365,2016
·         Microsoft Visual Studio 2015 and SQL Server Data Tools in Visual Studio 2015
·         Microsoft Visual Studio 2013 and Microsoft SQL Server Data Tools - Business Intelligence for Visual Studio 2013
·         Microsoft Visual Studio 2012 and Microsoft SQL Server Data Tools - Business Intelligence for Visual Studio 2012
·         Visual Studio 2010 and SQL Server Data Tools
·         To install SQL Server Data Tools, on the PC running Visual Studio 2010 go to the Microsoft SQL Server 2012 Express download page, download the following files appropriate to your CPU architecture and language:
·         ENU\x64\SQLEXPRADV_x64_ENU.exe
·         ENU\x86\SQLEXPRADV_x86_ENU.exe
·         Select the "SSDT" or "SQL Server Data Tools" installation.
2015
·         Microsoft Visual Studio 2012 and Microsoft SQL Server Data Tools - Business Intelligence for Visual Studio 2012 

-- OR --
·         Visual Studio 2010 and SQL Server Data Tools
·         To install SQL Server Data Tools, on the PC running Visual Studio 2010 go to the Microsoft SQL Server 2012 Express download page, download the following files appropriate to your CPU architecture and language:
·         ENU\x64\SQLEXPRADV_x64_ENU.exe
·         ENU\x86\SQLEXPRADV_x86_ENU.exe
·         Select the "SSDT" or "SQL Server Data Tools" installation.
2013
The following components are required:
·         Business Intelligence Development Studio and Visual Studio 2008 Service Pack 1

-OR-

·         SQL Server Data Tools and Visual Studio 2010
·         On the Microsoft SQL Server 2012 Express download page, download the following files appropriate to your CPU architecture and language:
·         ENU\x64\SQLEXPRADV_x64_ENU.exe
·         ENU\x86\SQLEXPRADV_x86_ENU.exe
·         Select the "SSDT" or "SQL Server Data Tools" installation.
2011
The following components are required:
·         Business Intelligence Development Studio and Visual Studio 2008 Service Pack 1
-OR-
·         SQL Server Data Tools and Visual Studio 2010
·         From Microsoft SQL Server 2012 Express download page, download the following files appropriate to your CPU architecture and language:
·         ENU\x64\SQLEXPRADV_x64_ENU.exe
·         ENU\x86\SQLEXPRADV_x86_ENU.exe
·         Select the "SSDT" or "SQL Server Data Tools" installation.

Download Reporting extension for Dynamics 365, 2016

Download Reporting extension for Dynamics 2015

Download Reporting extension for Dynamics 2013

Download Reporting extension for Dynamics 2011


Wednesday, July 12, 2017

Dynamics CRM DateTime format filter in web API

Dynamics CRM DateTime format filter in web API:
function getODataUTCDateFilter(date) {
   var monthString;
   var rawMonth = (date.getUTCMonth() + 1).toString();
   if (rawMonth.length == 1) {
       monthString = "0" + rawMonth;
   }
   else { monthString = rawMonth; }
   var dateString;
   var rawDate = date.getUTCDate().toString();
   if (rawDate.length == 1) {
       dateString = "0" + rawDate;
   }
   else { dateString = rawDate; }
   var hourString = date.getUTCHours().toString();
   if (hourString.length == 1)
       hourString = "0" + hourString;
   var minuteString = date.getUTCMinutes().toString();
   if (minuteString.length == 1)
       minuteString = "0" + minuteString;
   var secondString = date.getUTCSeconds().toString();
   if (secondString.length == 1)
       secondString = "0" + secondString;
   var DateFilter = "datetime'";
   DateFilter += date.getUTCFullYear() + "-";
   DateFilter += monthString + "-";
   DateFilter += dateString;
   DateFilter += "T" + hourString + ":";
   DateFilter += minuteString + ":";
   DateFilter += secondString + "Z'";
   return DateFilter;
}

"IN" operation in fetch XML on Lookup control AddPresearch

"IN" operation in fetch XML on Lookup control AddPresearch


In the account lookup filter two(n of account) account name:
<filter type='and'>

<condition attribute='name' operator='in'>
<value>Test</value>
<value>ABCD</value>
</condition>

</filter>

Enable and Disable controls inside a tab


 Enable / Disable a Section

function sectiondisable(sectionname, disablestatus) {
    var ctrlName = Xrm.Page.ui.controls.get();
    for (var i in ctrlName) {
        var ctrl = ctrlName[i];
        if (ctrl.getParent() == null)
            continue;
        var ctrlSection = ctrl.getParent().getName();
        if (ctrlSection == sectionname) {
            ctrl.setDisabled(disablestatus);
        }
    }
}


 Enable / Disable a Tab
function tabdisable(tabname, disablestatus) {
    var tab = Xrm.Page.ui.tabs.get(tabname);
    if (tab == null)
        return;
    else {
        var tabsections = tab.sections.get();
        for (var i in tabsections) {
            var secname = tabsections[i].getName();
            sectiondisable(secname, disablestatus);
        }
    }
}

Friday, June 23, 2017

Click Phone Number on HTML page calling with Skype as similar to Dynamics CRM Phone Number

Click Phone Number on HTML page calling with Skype as similar to Dynamics CRM Phone Number

On CRM, we are embedded the HTML page in the contact screen. In HTML page there is a phone number link(anchor tag) button.

When user click the field need to call with Skype as similar to Dynamics CRM.




On the HTML page we have to create a anchor tag

  <a href="callto:768-555-0156" id="iAnchor"  onclick="return Test();" use_skype_protocol_grid="True" country_code="+91" title="Prefix the number with &quot;+<country code><area code>&quot; and install Skype to make calls from Microsoft Dynamics 365.">768-555-0156</a>

Attribute Definitions:
href= callto:Phonenumber
use_skype_protocol_grid= call in skype or skypeBusiness/Lync(Administrator->SystemSetting->Set the telephone provider)
country_code= (Administrator->SystemSetting->Default country/code region)



 function Test() {
  //Syntax        //Mscrm.Shortcuts.openPhoneWindow(phoneNumber,LOCID_COUNTRY_CODE,LOCID_USE_SKYPE_PROTOCOL)

    parent.Mscrm.Shortcuts.openPhoneWindow("768-555-0156", "+91", "true")
 }

The below is the original method in the Dynamics CRM  "_static/_grid/action.js"
//_static/_grid/action.js
function openPhoneNumberFromGrid(e)
{
    try
    {
        var o = e.target || e.srcElement;
        if(!IsNull(o))
        {
            while(o.tagName != "A")
                o = o.parentNode;
            var phoneNumber = XUI.Html.GetText(o),
                LOCID_COUNTRY_CODE = "",
                LOCID_USE_SKYPE_PROTOCOL = "";
            if(!isNullOrEmptyString(phoneNumber))
            {
                if(o.hasAttribute("country_code"))
                    LOCID_COUNTRY_CODE = o.getAttribute("country_code");
                LOCID_USE_SKYPE_PROTOCOL = o.getAttribute("USE_SKYPE_PROTOCOL_GRID");
                Mscrm.Shortcuts.openPhoneWindow(phoneNumber,LOCID_COUNTRY_CODE,LOCID_USE_SKYPE_PROTOCOL)
            }
        }
    }
    catch(e)
    {
    }
    return false
}




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: