CRM2011 – Sql Timeout during the export solution

Another day, another problem to resolve: Last Friday I tried to export a solution as usual but after several minutes I did not have my solution package. I opened the CRM Server and I started to check the Event Viewer. Inside the EventViewer I had this error:

RequestUrl: d2devcrm02/…/dlg_exportsolution.aspx;command=exportsolution&ismanaged=0&optionxml=%3csettings%3e%3cexportAutoNumber%3efalse%3c%2fexportAutoNumber%3e%3cexportCalendar%3efalse%3c%2fexportCalendar%3e%3cexportCustomization%3efalse%3c%2fexportCustomization%3e%3cexportEmailTracking%3efalse%3c%2fexportEmailTracking%3e%3cexportGeneral%3efalse%3c%2fexportGeneral%3e%3cexportMarketing%3efalse%3c%2fexportMarketing%3e%3cexportOutlookSynchronization%3efalse%3c%2fexportOutlookSynchronization%3e%3cexportRelationshipRole%3efalse%3c%2fexportRelationshipRole%3e%3cexportIsvConfig%3efalse%3c%2fexportIsvConfig%3e%3c%2fsettings%3e, StackTrace: [CrmException: SQL timeout expired.]
   at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
   at Microsoft.Crm.Application.Platform.ServiceCommands.ExportSolutionCommand.Execute()
   at Microsoft.Crm.Dialogs.ExportSolutionPage.ExportSolution(String ismanaged, String optionXml)
   at Microsoft.Crm.Dialogs.ExportSolutionPage.ConfigureForm()
   at Microsoft.Crm.Application.Controls.AppUIPage.OnPreRender(EventArgs e)
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

[HttpUnhandledException: Exception of type ‘System.Web.HttpUnhandledException’ was thrown.]
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 13.06.2016 16:06:31
Event time (UTC): 13.06.2016 14:06:31
Event ID: 32a2c5bc89a145d7bf49d70c8d8f4f28
Event sequence: 616
Event occurrence: 1
Event detail code: 0
 
Application information:
    Application domain: /LM/W3SVC/1/ROOT-1-131102998861671990
    Trust level: Full
    Application Virtual Path: /
    Application Path: C:\Program Files\Microsoft Dynamics CRM\CRMWeb\
    Machine name: D2DEVCRM02
 
Process information:
    Process ID: 4332
    Process name: w3wp.exe
    Account name: NT AUTHORITY\NETWORK SERVICE
 
Exception information:
    Exception type: CrmException
    Exception message: SQL timeout expired.
   at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
   at Microsoft.Crm.Application.Platform.ServiceCommands.ExportSolutionCommand.Execute()
   at Microsoft.Crm.Dialogs.ExportSolutionPage.ExportSolution(String ismanaged, String optionXml)
   at Microsoft.Crm.Dialogs.ExportSolutionPage.ConfigureForm()
   at Microsoft.Crm.Application.Controls.AppUIPage.OnPreRender(EventArgs e)
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 
 
Request information:
    Request URL: d2devcrm02/…/dlg_exportsolution.aspx{E78FB0AD-C209-45F2-B3C2-969B588AE213}&command=exportsolution&ismanaged=0&optionxml=<settings><exportAutoNumber>false</exportAutoNumber><exportCalendar>false</exportCalendar><exportCustomization>false</exportCustomization><exportEmailTracking>false</exportEmailTracking><exportGeneral>false</exportGeneral><exportMarketing>false</exportMarketing><exportOutlookSynchronization>false</exportOutlookSynchronization><exportRelationshipRole>false</exportRelationshipRole><exportIsvConfig>false</exportIsvConfig></settings>
    Request path: /winVSNextCommissioning/_grid/cmds/dlg_exportsolution.aspx
    User host address: 10.20.180.16
    User: META10\crmdeploymentadmin
    Is authenticated: True
    Authentication Type: Negotiate
    Thread account name: NT AUTHORITY\NETWORK SERVICE
 
Thread information:
    Thread ID: 21
    Thread account name: NT AUTHORITY\NETWORK SERVICE
    Is impersonating: False
    Stack trace:    at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
   at Microsoft.Crm.Application.Platform.ServiceCommands.ExportSolutionCommand.Execute()
   at Microsoft.Crm.Dialogs.ExportSolutionPage.ExportSolution(String ismanaged, String optionXml)
   at Microsoft.Crm.Dialogs.ExportSolutionPage.ConfigureForm()
   at Microsoft.Crm.Application.Controls.AppUIPage.OnPreRender(EventArgs e)
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 
 
Custom event details:

After a scounting on google I found that there are a number of causes for this error message and there are many article about the problem. I added the the OLEDBTimeout and the ExtendedTimeout registry subkeys to increase the time-out values

  1. Click Start, click Run, type regedit, and then click OK.
  2. Locate the following registry subkey:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM
  3. Right-click MSCRM, point to New, and then click DWORD Value to create a new DWORD value.
  4. Rename the DWORD value to the following value:
    OLEDBTimeout
  5. Right-click the DWORD value, and then click Modify.
  6. In the Edit DWORD Value dialog box, type 86400 in the Value data box, click Decimal in the Base option, and then click OK.Note According to the requirement of the computer that is running SQL server and the number of customization files, the value can be larger than 86400. The value of 86400 is equivalent to 24 hours.
  7. Right-click MSCRM, point to New, and then click DWORD Value to create a new DWORD value.
  8. Rename the DWORD value to the following value:
    ExtendedTimeout
  9. Right-click the DWORD value, and then click Modify.
  10. In the Edit DWORD Value dialog box, type 1000000 in the Value data box, and then click OK.Notes
    • In the Value data box, you can type a value that is larger than 1,000,000. However, do not type a value that is larger than 2,147,483,647. This is hexadecimal 0x7FFFFFFF.
    • If this key already exists, notice the current value. After you have completed the import or the upgrade for Microsoft Dynamics CRM, set the value of this key back to the original value or delete the key if it did not previously exist. The default OLEDB timeout value is 30 seconds.

After I reset IIS and I tried to export the solution again… and run all!!!

Annunci

CRM2016 – Outlook 2016 plugin installation error

Today I tried to install the new CRM2016 plugin for Outlook 2016. I had a strange problem because the installation run but I did not have any errors:

c2

I had the previous status without a progress. I tried to wait for 30 minutes and after I stopped the setup.

On Eventviewer I found a continuos error for service “Computerbrowser”

c1

I tried to restart the service but it was impossible because there was an error 1053.

Error 1053: The service did not respond to the start or control request in a timely fashion.

After a google scouting I found a solution:

  1. Go to Start > Run > and type regedit
  2. Navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
  3. With the control folder selected, right click in the pane on the right and select new DWORD Value
  4. Name the new DWORD: ServicesPipeTimeout
  5. Right-click ServicesPipeTimeout, and then click Modify
  6. Click Decimal, type ‘180000’, and then click OK
  7. Restart the computer

The cause of the problem was that the Microsoft Windows Service Control Manager controls the state (i.e., started, stopped, paused, etc.) of all installed Windows services. By default, the Service Control Manager will wait 30,000 milliseconds (30 seconds) for a service to respond. However, certain configurations, technical restrictions, or performance issues may result in the service taking longer than 30 seconds to start and report ready to the Service Control Manager.

After this procedure the Outlook plugin was istalled without any problem.

MSCRM : Delete Reports from database

Today we needed to delete more 100 reports from our solution. This operation is boring and long to do directly on CRM. My mate Flavio found an alternative way to clean reports from Database. It is an unsupport solution but for our needs run in right way.

The queries are simple:

DECLARE @Id nvarchar(max)
DECLARE MY_CURSOR CURSOR
LOCAL STATIC READ_ONLY FORWARD_ONLY
FOR
SELECT DISTINCT ReportId From ReportBase WHERE name like('Sub Accounts %')

OPEN MY_CURSOR
FETCH NEXT FROM MY_CURSOR INTO @Id
WHILE @@FETCH_STATUS = 0
BEGIN
--Do something with Id here
PRINT @Id
DELETE FROM dbo.ReportCategoryBase WHERE ReportId = @Id
DELETE FROM dbo.ReportEntityBase WHERE ReportId = @Id
DELETE FROM dbo.ReportLinkBase WHERE ReportId = @Id
DELETE FROM dbo.ReportLinkBase Where LinkedReportId = @Id
DELETE FROM dbo.ReportVisibilityBase WHERE ReportId = @Id
DELETE FROM dbo.Dependencybase WHERE DependencyId
in(SELECT DependencyId FROM dbo.Dependency WHERE RequiredComponentObjectId = @Id)
DELETE FROM dbo.Dependencybase WHERE DependencyId
in(SELECT DependencyId FROM dbo.Dependency WHERE DependentComponentObjectId = @Id)
DELETE FROM dbo.SolutionComponentBase WHERE ObjectId = @Id
DELETE FROM dbo.DependencyNodeBase WHERE ObjectId = @Id
DELETE FROM dbo.ReportBase WHERE ReportId = @Id;

FETCH NEXT FROM MY_CURSOR INTO @Id
END
CLOSE MY_CURSOR
DEALLOCATE MY_CURSOR

That’s all.

Upgrade CRM2015 to CRM2016 : Database having version 8.0.1.79 is not supported for upgraded.

Today I had a problem to migrate CRM2015 to CRM2016. When I try to import I had this error: Database having version 8.0.1.79 is not supported for upgraded.

I thought that the problem was related with CRM database but Microsoft Community helps me to understand the problem:

The error is misleading as it has nothing to do with the version of the database. If you are trying to import an organization database that has already been imported to an organization on that crm server, you will get this error, because the organization has the same ID.

To resolve it I found two solutions:

  1. Remove the organization with the same ID from server
  2. Change server

But my mate Martin got me another possiblity: Change organization ID from database. It is an unsupported solution but for my needs is perfect. Now I executed the SQL Script and all it is import right.  If you want, you can find the script on my GITHUB: Change Organisation ID V3.sql.

 

 

CRM2016 – Wrong height Layout inside a WebResource on Form

We have a HTML Page as a webresource inside our CRM. In this webPage there are two dropdownlist. We need to manage a Due date.
This was created in the past for CRM2011 and all layout worked always in right way.

Capturecrm2011

CRM2011 – Right layout

We upgrade our CRM to CRM2016 and we start with layout problem:

Capture11

CRM2016 – Wrong layout

 

I must insert this piece of code inside my webresource:

if (typeof parent.$ !== 'undefined') //Check for CRM2011 version. Work only on CRM2015/CRM2016
{
   parent.$( document ).ready(function() {
           var elem = parent.$('#WebResource_duedate');
           elem.height('24px');
   });
}

This code works on DOM directly and change the height. The result is:
Capturenew

CRM2016 – Right Layout

CRM2013 – Save and refresh an entity without postback

Today I had a strange problematic for my client: I needed to update an hidden field without that the user niticing it. I found a solution on this blog: http://www.hebbink.com/post/2015/06/22/saving-and-refreshing-a-crm-entity-form-without-postback

function SaveAndRefresh() {
    Xrm.Page.getAttribute("myAttributeName").setValue(null);
    Xrm.Page.data.refresh(true);
}

Thanks a lot for this great solution!

Unable to activate CRM List Component in Sharepoint

Last week I installed a new CRM and Sharepoint enviroment on my client.  I had a strange problem when I tried to install and activate List Component on Sharepoint: After the installation (I did not have any problem during the process) I tried to activate List Component Plugin: The result was that the plugin was not active but I did not have any error. After some (long) minutes, I found the problem:

Inside zip package setup for CRM List Component there is a powershell file named AllowHtcExtn.ps1

We need to execute this file before activate.

On Technet we can read this :

[…By default, HTML component (.htc) files aren’t enabled on SharePoint 2013. …]

 

After we can activate our plugin.

That’s all 🙂