Publish Workflow On behalf of Some Other User. (Impersonation in Dynamics CRM)

Dynamic CRM workflow can generally only be published by owner. If you want to assign workflow to different support/sales manager and publish the workflow on their behalf then CRM does not allow you do it…

Then I found out about impersonation in CRM, as per this user account under which the impersonation code is to run must be added to the PrivUserGroup group in Active Directory. So your user account or admin user account who should have privileges to run code on behalf of someone else.

Once you have above things set up then it becomes easy do above task (i.e. Publish the workflow on behalf of someone else)

Following are steps to achieve this in Dynamics CRM.

Step 1: Add new button to workflow screen using ISV.Config.

This would look like as follows..

Step 2: Write Java script code for to publish the workflow one behalf to current workflow owner. If workflow is already published then unpublish the current workflow.