Dynamics 365: Case form got corrupted and couldn’t open after Publish Customization.


, , , ,

Hello Everyone,


Today would like to share a scenario which literally froze me for a minute while customizing Dynamics 365. Recently we were working on the Case form and suddenly after publishing customization, the Case form couldn’t open anymore!!! Thinking that the newly created fields on the forms would be the culprit, tried to open the case form editor from customization area but that also failed. The page din’t load at all, this was the first time I ever faced this scenario. 😮

Having no clue at all as no event logs were logged on servers, I searched if there had been a single same scenario faced by anyone. Luckily I found one in the Microsoft community here discussing exactly the same issue.

I followed the suggested answer to remove the control with placeholder, having the thought that we were too using Chrome while customizing the Case forms.



  1. Create an unmanaged solution with the bugged form.
  2. Export the solution.
  3. Unzip the archive and edit the “customization.xml” file to remove all “control” tags containing “placeholder”.
  4. Create a new zip archive with the new “customization.xml” file.
  5. Import it to the CRM and publish all the customizations.


We opened our customization file and did find few entries with the Placeholder control.placeholder

I followed the above mentioned steps and bingo, the case form reopened !!! Had a big relief and a sense of victory… 😀

Hope this will help someone caught in a similar issue. Thanks and have a great day!


Add Validation or Custom Script to OOB Buttons on CRM forms


, , , , , , ,

Hello Everyone,


Recently I had a requirement to add in a validation logic before I Close the Opportunity as Won or Lost. The logic was simply i.e. to make sure the Est Close Date is not left empty; rather set to a date value before closure for better reporting and analysis purpose.

The best and recommended approach to do this is hide the OOB button and Add the same functionality to a new button with your embedded validation script. To hide and copy the OOB button functionality I used Ribbon Workbench. I would recommend to watch all the video series posted by Scott Durow himself on Ribbon Workbench here before proceeding to have a clear understanding of the tool.


To start with, first I would create a new Solution which will have only the Opportunity Entity and the new WebResource. This is required for the Ribbon Workbench to populate only the opportunity ribbons to edit.RibbonWorkbench3-2


Next, open the new XRMToolBox and connect to the Ribbon Workbench 2016.RibbonWorkbench1-2


Create a new connection to your Organization. RibbonWorkbench2-2


Once the connection to your CRM Organization is successful, select the newly created Solution and click OK.RibbonWorkbench4-2



The Ribbon Workbench Tool will download the solution and open all the opportunity ribbons in their own format to be edited. RibbonWorkbench5-2


Since we need to apply the validation on the OOB buttons Close as Won and Close as Lost. Hence we first make a copy of the OOB button so we don’t touch and keep the original customization as a backup. Note that the OOB button properties are grayed out. RibbonWorkbench6-2


After copying the OOB button, right click the same group and select Paste. RibbonWorkbench7-2


A new button with the same name but a different ID would be created. Notice that this new button Control properties are not grayed-out and open for editing. RibbonWorkbench8-2


Just now only the button properties are editable. To update the commands section, right click on the same button and click on ‘Customise CommandRibbonWorkbench9-2


This will open the Command properties to be edited. Since the commands ID is still the same for the new button hence we would take a copy and work on it; without touching the original else the OOB buttons commands will also be updated. RibbonWorkbench10-2


Likewise, paste the same under the command section.RibbonWorkbench11-2


Notice that a new command with a different ID would be created. You can Update the ID of the command if you wish to more meaningful.RibbonWorkbench12-2


Browse to the new button and update the command to the latest copied one. RibbonWorkbench13-2


Also update the Command Core properties. RibbonWorkbench14-2


Once updated, now we can proceed to change the copied command attached to the new button now. Browse to the command, notice that a Custom Javascript Action is present with Library, Function Name and a Boolean Parameter.  Take of note of these as we would need this back again in our custom webresource later. RibbonWorkbench15-2


Since we need to attach our own webresource, hence we would delete the already existing one by right click and Delete on the Action Tab.RibbonWorkbench16-2


Now click on Add Actions and select the option Javascript Action.RibbonWorkbench17-2


Search for your newly created webresource and add in the function name. For now this function only has the alert to make sure the function is called on the new button click.RibbonWorkbench18-2


Once Done, Publish the changes. RibbonWorkbench19-2


After publishing, refresh your CRM Organization and Open the Opportunity. Notice the 2 Close as Won buttons on the ribbon (One copied and another OOB). Click on the copied button and my alert works! 😀 RibbonWorkbench21-2



Now to make sure the OOB button functionality is not updated and remains the same, click on it and the Close Opportunity window will pop-up. RibbonWorkbench22-2


Once the button functionalities are verified for both the copied and OOB buttons. Now it’s time to update the webresource with the exact requirement.

Requirement:- If the Est Close Date field is blank then a confirmation Dialog should appear asking the user to update the Est Close Date as this field cannot be left blank. If the User select OK then apply the focus to the field so that user can update the Est Close Date. Else if the user selects Cancel then update the field by default to the current date and pop up the Close Opportunity window to continue. To restore the OOB functionality we would call the same Function Name with the defined patameter we noted earlier. 😀

My code as follows:

function OppCloseDate() {

var CloseDate= Xrm.Page.data.entity.attributes.get(“estimatedclosedate”);

if (CloseDate.getValue() == null)
Xrm.Utility.confirmDialog(“Est. Close Date of Opportunity cannot be Blank. Update the Close date?”,
function() {
Xrm.Page.ui.controls.get(“estimatedclosedate”).setFocus(); //Set the focus on Est Close Date Field
} ,
function() {
var TodaysDate= new Date(); // Get Today’s current date
Xrm.Page.getAttribute(“estimatedclosedate”).setValue(TodaysDate); // Update the Close Date to Today’s Date
Mscrm.OpportunityCommandActions.opportunityClose(true); // Call the OOB method, Mark Opp as Won

else {
Mscrm.OpportunityCommandActions.opportunityClose(true); // Call the OOB method, Mark Opp as Won


After Publishing the changes to the webresource, will test my jScript functionality. (M having goosebumps, hopefully would run without errors! ) Reopen the Opportunity record and click on the copied button for the new script to run.

Since the Est Close Date is empty, the confirmation Dialog box will appear. As per the script logic all works well.RibbonWorkbench25-2


If select on the Cancel Button, then notice the date in the form field will be updated and Close Opportunity will pop-up, just following the OOB button behavior. RibbonWorkbench26-2


Once tested the functionality is working all fine. Now we can proceed to hide the OOB button. Right click on the button and select the option to hide.RibbonWorkbench27-2


Once hidden the red cross mark will appear on the button and the Hide Action section will be updated with the record under Solution Elements.RibbonWorkbench28-2

Update the same steps for the Close as Lost and all good to go!

Hope that would be helpful to someone. Thanks and have a great day! 🙂





Dynamics CRM: Calculate Date in jSctipt


, , , , ,

Hello Everyone,

In my previous blog, I talked about setting and clearing the FormNotifcations on the Dynamics CRM Forms. Here I’m going to talk about another useful script mostly used; Date Calculation.

Difference between 2 dates in Days:


function CalculateDays(Date1 , Date2) {
var OneDay = 1000*60*60*24; //The number of millisec in a day

var DateTime1 = new Date(Date1).getTime(); // convert date1 in milliseconds
var DateTime2 = new Date(Date2).getTime(); // convert date2 in milliseconds
var DateDiff = Math.abs(DateTime2 – DateTime1); //difference of dates in millisec

return Math.round(DateDiff / OneDay); //difference in days


Sample code to use this in for 2 CRM date fields:

var FutureDate= Xrm.Page.data.entity.attributes.get(“ashwin_futuredate”);

var PastDate= Xrm.Page.data.entity.attributes.get(“ashwin_pastdate”);


if (FutureDate.getValue() == null || PastDate.getValue() == null)


Xrm.Utility.alertDialog(“FutureDate or PastDate values should not be left blank!”,function(){return;});



else {

FutureDateVal= FutureDate.getValue(); // the fieldvalue returns datetime, so need to remove time

PastDateVal = PastDate.getValue();  // the fieldvalue returns datetime, so need to remove time


var year_f = FutureDateVal.getFullYear();

var month_f = FutureDateVal.getMonth();

var day_f = FutureDateVal.getDate();

var FutureDateValue = new Date(year_f, month_f, day_f);  //get only the date, time removed.


var year_p = PastDateVal.getFullYear();

var month_p = PastDateVal.getMonth();

var day_p = PastDateVal.getDate();

var PastDateValue = new Date(year_p, month_p, day_p);  //get only the date, time removed.


var Days = CalculateDays(PastDateValue, FutureDateValue);





I’m pinning this script useful for me in my upcoming projects. Hope this will be helpful for someone too.

Thanks ! 🙂


Dynamics 365: Alert and Confirm Dialog boxes


, , , , , , ,

Hello Everyone,

The two dialog boxes (Alert and Confirm) have been around in Dynamics CRM for quite long and I still use them regularly in the jScrip. The earlier windows.alert / windows.confirm will be deprecated in the Dynamics 365 mobile client and recommended to use Xrm.Utility.alertDialog / Xrm.Utility.confirmDialog instead, more details in the MSDN article here.



Displays a dialog box containing an application-defined message.



Name Type Required Description
message String Yes The text of the message to display in the dialog.
onCloseCallback Function No A function to execute when the OK button is clicked.


The sample code which I use:

Xrm.Utility.alertDialog(“Email should not be left blank!”,function(){return;});




Displays a confirmation dialog box that contains an optional message as well as OK and Cancel buttons.



Name Type Required Description
message String Yes The text of the message to display in the dialog
yesCloseCallback Function No A function to execute when the OK button is clicked.
noCloseCallback Function No A function to execute when the Cancel button is clicked.



The sample code which I use:


“Opportunity Close Date should not be left Blank. Update the close date?”,

function() {
} ,

function() {
var TodaysDate= new Date(); // Get Today’s current date



In the above code, I want to make sure the OppCloseDate shouldn’t be left blank. I’ll set the focus of the field to update if the user clicks the button OK. Else if the user selects Cancel, I’ll default it to today’s date.


I’m pinning this down as a day to day useful scripts during development considering the Dynamics 365 mobile client as well. Hope that would be helpful. Thanks ! 🙂

Set and Clear Notifications: {Info/Warning/Error} on Dynamics CRM Forms


, , , , , ,

Hello Everyone,

Setting up the {Info, Warning, Error] notifications on the forms is a generic requirement for most of the time which are based on multiple scenarios (eg. on case page load to notify the agent any particular details about the customer). I use the below jScript again and again in my deployment so pinning it down below. The detailed are there in the MS article and docs.



Xrm.Page.ui.setFormNotification(message, level, uniqueId);

Where the 3 parameters are

TypeString. The text of the message.

TypeString. The level of the message.

The level defines how the message will be displayed.

  • ERROR : Notification will use the system error icon.
  • WARNING : Notification will use the system warning icon.
  • INFO : Notification will use the system info icon.
TypeString. A unique identifier for the message used with clearFormNotification to remove the notification.



The Next script would be to clear those notification based on the uniqueId assigned to the notification above.




And now the best part; flashing the formNotifications only for a couple of seconds and clear them automatically. This can be done via Timeout function:

setTimeout( function () { Xrm.Page.ui.clearFormNotification(id); }, time );


My overall sample code below:

var message = “The Contract is about to expiry, kindly consult customer to renew.”;
var id = “101”;  //Notification Id
var time = 5000;  //Display time in milliseconds

//Display the notification
Xrm.Page.ui.setFormNotification(message, type, id);

//Wait the designated time and then remove the notification
setTimeout( function () {Xrm.Page.ui.clearFormNotification(id);}, time );


I would keep this as a sticky note, thanks to Jason Lattimer for his blog post; it still works on the D365 forms.




Either a required impersonation level was not provided, or the provided impersonation level is invalid.


, , , , ,

Hello Everyone,

In my previous CRM Setup, after completing the Installations I was able to create a new Organization successfully without any errors. But when I opened the first instance of CRM then the IE showed up the following error:

“Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)]”LOgin-error-2


Since it was an restricted environment with all the service accounts set to minimum permissions, I knew the impersonation error has to do something with the missing access/permission. To understand the error in detail, I searched the Event Viewer and found the Web Event error under Windows Logs -> Application.LOgin-error1-2



The error details further mentioned that my App Pool account is missing the impersonation privilege as Is impersonation is set to False.


I found the same problem discussed in the forum here and here. The resolution talks about adding all the service accounts as the local administrator in the security group of the server. Since the service accounts are suppose to maintain the minimum privileges, hence I only added my issue account i.e. the App Pool account as the user under Adminstrator.LOgin-error13-2


After adding the account, there was no more error and I was able to browse the CRM. Hope that was helpful. Thanks !





[DBNETLIB][ConnectionOpen (SECDoClientHandshake()).]SSL Security error


, , , , , ,

Hello Everyone,

In my previous blog I discussed about solving the SSL Security error: SECCreateCredentials(). After solving this error when I resumed my CRM installation, another similar error pop up again. But this time it was SSL Security error: SECDoClientHandshake()

This error looked quite familiar as I already read before in one of the Microsoft Support article.  Since I knew this was a known error, still I tried to follow up the steps to simulate the SQL server connection error via Microsoft OLE DB Provider using a *.UDL file.


Reason was quite clear: This fails because the secured connection between the Dynamics CRM Server 2016 and the SQL Server needs TLS 1.0 to be enabled for the OLE DB Provider for SQL Server. And the SQL Server may not have TLS 1.0 enabled for secure channel communication

As the suggested resolution, I opened the regedit and checked the TLS 1.2 status which by default Enabled was Set to 0 and DisabledByDefault was set to 1Installation_Error3-2


I later enabled the TLS 1.2 under both the Client and the Server folders by settings the Enabled to 1 and DisabledByDefault to 0Installation_Error4-2

[DBNETLIB][ConnectionOpen (SECCreateCredentials()).]SSL Security error.


, , , , , ,

Hello Everyone,

During one of my CRM Installation when everything was going smooth, the following error popped up:

“Could not connect to the following SQL Server: ‘XXXXXXXXX’.

Verify that the server is up and running and that you have SQL Server administrative credentials.

[DBNETLIB][ConnectionOpen (SECCreateCredentials()).]SSL Security error.”




The next immediate thing was to look up at the Event Viewer logs. Under Windows Logs -> System found the error:

Source: Schannel

“A fatal error occurred while creating a TLS client credential. The internal error state is 10013”



I did even try to make an ODBC Data Source connection from my Web server to the SQL server but still the same error, confirming the connectivity issues through SSL Security.

ODBC Error-2


I searched lot many blogs and articles with various suggestions but the one which solved my issue was the response from the Microsoft community support in the msdn and the iis-forum.

They both article points to the same issue and the resolution. In my case, I was already having Windows Server 2016 and SQL 2016 which are already TLS 1.2 compliant; even my .Net Framework was also updated to 4.6


The only solution left was Enabling the FIPS compliant encryption algorithm under system cryptography. As suggested I followed the same:

a. In Control Panel, click Administrative Tools, and then double-click Local Security Policy.

b. In Local Security Settings, expand Local Policies, and then click Security Options.

c. Under Policy in the right pane, select System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing.



d. By default it’s set to Disabled.

e. Double Click to open the option and then click Enabled.


f. Restart the machine for the policies to take effect.


I resumed my CRM installation and this time there was no issue of SSL Security error: SECCreateCredentials().  However, there was another SSL Security error: SECDoClientHandshake() which I’ll talk about in my next blog.


For further info on the FIPS, there is a Microsoft support article which is worth reading. Hope that was helpful. Thanks!







Action Microsoft.Crm.Setup.Common.InstallWindowsSearchAction failed


, , , , , ,

Hello Everyone,


During installation the Dynamics CRM 2016 in the new Web-Server machine; in the midst of the installation process I received the below Error:



The Error description clearly says that – the service cannot be started, either because it is disabled or because it has no enabled devices associated with it.

I opened the Services and browse to the Windows Search. Noticed that by default in the new server this service is Disabled.



Double clicked to open the service and first updated the Startup type: AutomaticCRM_Error2-2


Next I clicked on the Start button to start the Windows Search service.CRM_Error3-2


Refresh the services page to make sure the Windows Search service is started properly. CRM_Error4-2

Once Started, click on the Retry button and the installation will resume.


Hope that was helpful. Thanks !



Microsoft.CRM.Setup.SRSDataConnector.AddBindingRedirectForRDHelper failed


, , , , , , ,

Hello Everyone,

While Installing the SRS Data Connector in DB-Server, I came across below error:-

Microsoft.CRM.Setup.SRSDataConnector.AddBindingRedirectForRDHelper failed


Could not find part of the path ‘<E:\Program Files\Microsoft SQL Server\MSRS13.MSSQLSERVER\Reporting Services\ReportManager\web.config>’


I browsed to the patch and noticed that there was actually no Report Manager folder under Reporting Services. Thankfully I came across the blogs from Hitachi here who experienced the same error and consulted Microsoft with the following resolutions below:


A. Browse to the folder location:

E:\Program Files\Microsoft SQL Server\MSRS13.MSSQLSERVER\Reporting Services



B. Create a new folder named ‘ReportManagerimage117


C. Copy the web.config from the ReportServer folder to the newly created ReportManager folderimage119


D. Once Completed, run the setup again and there will be no more errors.


Hope that was helpful. Thanks !