We have several workflows that get trapped in a waiting state when they are run. When I pull a list of system jobs in a waiting state, the error on these jobs is:
"Workflow paused due to error: Unhandled Exception: System.Web.Services.Protocols.SoapException: Server was unable to process request.
Detail: <detail><error>
<code>0x80040220</code>
<description>SecLib::CrmCheckPrivilege failed. Returned hr = -2147220960 on UserId: 66f60ce6-738a-dd11-9674-001ec9d6dbbe and PrivilegeId: 6fd3eb4f-66e3-4587-b4ab-c064f03ad783</description>
<type>Platform</type>
</error></detail>
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Microsoft.Crm.SdkTypeProxy.CrmService.Execute(Request Request)
at Microsoft.Crm.Asynchronous.SdkTypeProxyCrmServiceWrapper.Execute(Object request)
at Microsoft.Crm.Workflow.Services.SendEmailActivityService.Execute(ActivityExecutionContext executionContext, SendEmailActivity sendActivity)
at Microsoft.Crm.Workflow.Activities.SendEmailActivity.Execute(ActivityExecutionContext executionContext)
at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext)
at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext)
at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)
at System.Workflow.Runtime.Scheduler.Run()
"
From the 'description' tag in the error, it looks like the user running the workflow does not have sufficient permissions. All this workflow does is check the setting of two fields in the Order entity, and if the check condition passes, an e-mail is generated and sent to someone in another department.
I have two questions regarding this:
1. Which user's credentials are used when a workflow runs? Is it the workflow owner, or the user triggering the workflow?
2. How do a figure out exactly which permissions I need to give to make the workflows work? They work if the workflow owner is given system administrator role but, of course, this is not acceptable.
Was I correct in thinking that the workflows run under the credentials (and therefore the permissions) of the workflow owner, and not the permissions of those triggering the workflow?