Avatar of I_play_with_DNA
I_play_with_DNA
 asked on

Workflow Permissions

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.
Enterprise SoftwareMicrosoft Dynamics

Avatar of undefined
Last Comment
I_play_with_DNA

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Jeff Wight

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
I_play_with_DNA

ASKER
Thanks.  I had previously looked up the user with the GUID in the error, but for some reason it didn't occur to me to do the same for the PrivilegeId.  Turns out it was the 'Send E-mail as Another User' permission.

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?
Jeff Wight

Ahh, yep.  Makes sense that it would be that permission.  Yes, I believe that is the case (workflow rule owner credentials are used).
I_play_with_DNA

ASKER
Awesome!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck