CRM 2011 Custom workflow error


Recently we encounter following error coming from some of custom workflow in CRM 2011 organization.

Workflow paused due to error: Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Expected non-empty Guid.Detail: -2147220989 Expected non-empty Guid. 2012-02-23T10:15:53.6646892Z -2147220970 System.ArgumentException: Expected non-empty Guid. Parameter name: id 2012-02-23T10:15:53.6646892Z at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Retrieve(String entityName, Guid id, ColumnSet columnSet, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType) at Microsoft.Crm.Extensibility.InprocessServiceProxy.RetrieveCore(String entityName, Guid id, ColumnSet columnSet) at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.Retrieve(String entityName, Guid id, ColumnSet columnSet) at Microsoft.Crm.Workflow.Services.RetrieveActivityService.c__DisplayClass1.b__0(IOrganizationService sdkService) at Microsoft.Crm.Workflow.Services.ActivityServiceBase.ExecuteInTransactedContext(ActivityDelegate activityDelegate) at Microsoft.Crm.Workflow.Services.RetrieveActivityService.ExecuteInternal(ActivityContext executionContext, RetrieveEntity retrieveEntity) at Microsoft.Crm.Workflow.Services.RetrieveActivityService.Execute(ActivityContext executionContext, RetrieveEntity retrieveEntity) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)


As per MS KB article this issue is fixed in CRM 2011 roll up 4, But for us even after applying roll up 6 this issue is not getting resolved.

so we have to update existing custom workflow to have a work around to fix this issue, following is more detail on this workaround.

So this error comes if you returning entity look up as return parameter from custom workflow and this error comes if your custom workflow returns null look up system throws above error.

To resolve this we put additional parameters called Dummy (Account GUID) as string and Success then pass test account record GUID as parameter.

public InArgument Dummy { get; set; }

public OutArgument success { get; set; }

we also updated custom workflow code to return this dummy account if we are not able return correct account.

// find matching account
Guid accountId = FindAccount(crmService, perameterEmail, perameterName);

if (!accountId.Equals(Guid.Empty))
this.accountId.Set(executionContext, new EntityReference("account", accountId));
success.Set(executionContext, true);

//return dummy account

this.accountId.Set(executionContext, new EntityReference("account", new Guid(Dummy.Get(executionContext))));
success.Set(executionContext, false);

In workflow editor we just need to check if this returned success flag, if it is true then we got correct Id and if it is false then it is dummy account.

So this workaround resolves this issue not nice but effective.

Hope this helps..



1 thought on “CRM 2011 Custom workflow error

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s