Monday, August 6, 2012

CRM Workflows Stuck in a Waiting State

Why some Workflows is stuck in a waiting state and a Generic SQL error is logged.
I resently had an issue at one of our customers with workflows in Micorosoft Dynamics CRM 2011.
If we triggered multiple instances of a workflow some got stuck in a waiting state, not all.
If we triggered the workflow on one record it worked.
So you might be facing the same issue as i did.
If you open up the waiting workflow under system jobs in CRM 2011 you might see an error like the following.
Workflow paused due to error: Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Generic SQL error.Detail: 
<OrganizationServiceFault xmlns:i="" xmlns="">
  <ErrorDetails xmlns:d2p1="" />
  <Message>Generic SQL error.</Message>
    <ErrorDetails xmlns:d3p1="" />
    <Message>Generic SQL error.</Message>
      <ErrorDetails xmlns:d4p1="" />
      <Message>System.Data.SqlClient.SqlException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #E0E9194D</Message>
      <InnerFault i:nil="true" />
      <TraceText i:nil="true" />
    <TraceText i:nil="true" />
  <TraceText i:nil="true" />
   at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Update(Entity entity, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)
   at Microsoft.Crm.Extensibility.InprocessServiceProxy.UpdateCore(Entity entity)
   at Microsoft.Crm.Workflow.Services.UpdateActivityService.<>c__DisplayClass1.<UpdateInternal>b__0(IOrganizationService sdkService)
   at Microsoft.Crm.Workflow.Services.ActivityServiceBase.ExecuteInTransactedContext(ActivityDelegate activityDelegate)
   at Microsoft.Crm.Workflow.Services.UpdateActivityService.UpdateInternal(Entity entity, String stepId)
   at Microsoft.Crm.Workflow.Services.UpdateActivityService.ExecuteInternal(ActivityContext executionContext, UpdateEntity updateEntity)
   at Microsoft.Crm.Workflow.Services.UpdateActivityService.Execute(ActivityContext executionContext, UpdateEntity updateEntity)
   at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
This can error can be logged because of deadlock issues in the CRM organization database when you run multiple workflows at the same time.
You can run SQL Server profiler and trace locks to confirm that this is the reason for the error.
An excellent way to handle deadlock issues with Microsoft CRM is to activate the following for you CRM organization database.

Make sure you have your SQL server tempdb on storage some extra space available for the tempdb because the tempdb will be used more by SQL server when you activate the above.

Friday, August 3, 2012

CRM 2011 Email Router for CRM Online

How to Configure CRM 2011 Email Router Deployment tab for CRM Online.

If you want to use CRM 2011 Email Router with CRM Online you might have a hard time to configure the Deployment tab in Email Router Configuration Manager.

The first thing you need to find is you CRM Online organizations unique name witch is not so easy if you don't know where to look :)

The CRM Online Organization Unique Name is listed in your CRM Online under Settings / Customization /Developer Resources

When you have your CRM Online organization Unique Name you can move on to CRM Email Router Configuration Manager.

The URL to CRM Online will be similar to the image below.
Deployment is Microsoft Dynamics CRM Online
Microsoft Dynamics CRM Server should be entered in the following format

The URLs to CRM Online is different depending on you location. (North America) (EMEA) (APAC)

Username = Live ID for a CRM Online account in your organization.
Password = password for the Live ID

The incoming and outgoing profile configuration is the same as if it was an on premise installation of CRM 2011.

The configuration of incoming and outgoing email settings for
users and queues in CRM is the same as on-premise. No difference for Online and
on premise.

Good luck!