Sunday, June 19, 2016

Workflow Email Send Issue-"You cannot send email as the selected user. The selected user has not allowed this or you do not have sufficient privileges to do so. Contact your system administrator for assistance."



Ground:
 -A background Workflow  executes in the security context of "the user who runs the WF" when : It is configured as an on-demand process ,And is started by a user using a Run Workflow command

-A background Workflow executes in the security context of "the owner of the workflow" when started based on an event trigger

- For a Real-time workflow  Execute as option decides whether the Workflow Runs in the security context of the owner of the Workflow or the user who runs the workflow.

 (Resource used:https://community.dynamics.com/crm/f/117/t/135682)

Based on the above facts, we can solution the WF in 2 ways:
1) Set a Queue as an Email Sender, this would not need any special permissions for Email Send

2)Else follow the below table
The Analysis Table
Type OF WF
Run As Info
Condition
Solution
Real Time Process
Run As WF Owner
If Sender is other than the Owner, WF fails(Unless special Send As Privilege enabled on Role as well as User Personal Setting done)
Mark the Owner and the Sender of Email as some System User- who has the rights to send Email
Example: 

-WF Owner=CRM Admin
-Mark the Sender too as:CRM Admin
Real Time Process
Run as executing User
If sender is other than the Executing User, WF Fails(Unless special Send As Privilege enabled on Role as well as User Personal Setting done)
-In the WF, have a step to update a hidden flag in the record(revert back at end).

-Mark the Modifed By of the record as the Sender of the Email
(No matter whoever is the Owner of the WF)
Background WF
Runs as Owner of WF
If Sender is other than the Owner, WF fails(Unless special Send As Privilege enabled on Role as well as User Personal Setting done)
Mark the Owner and the Sender of Email as some System User- 
Example: 
-WF Owner=CRM Admin
-Mark the Sender too as:CRM Admin

Dialog
Runs as executing User
If sender is other than the Executing User, WF Fails(Unless special Send As Privilege enabled on Role as well as User Personal Setting done)
 -In the WF, have a step to update a hidden flag in the record(revert back at end).

-Mark the Modifed By of the record as the Sender of the Email
(No matter whoever is the Owner of the WF) 




Another solution that can be applied in all the scenarios:
 Login as a System User say – CRM Admin and make the  below Email settings in the Personal Options by Navigating to - Options-->Email

to allow other Users to send Email on behalf of this User

No comments:

Post a Comment