Friday, May 20, 2011

Processes/Workflow ownership FAQs

I decided to post a blog article about this topic since I have been asked numerous times why solution import fails sometimes when trying to update an existing process. Before I get to the bottom of it, let me answer what are in my experience the most FAQ about process ownership:

Q1: Under what user’s context does the workflow execute? (If the workflow creates a record, who will be the owner of that new record?)

A1: It depends. Automatically triggered workflows (such as a workflow that triggers on account create) will execute in the context of the owner of the workflow. Therefore, if you have a send email step, the email will be by default sent from the e-mail account of the workflow owner. This is important to consider because the workflow owner might belong to a different business unit and have different privileges than the user who triggered the workflow (e.g. who created the account). Let’s say your workflow creates a task each time an account is created. Depending on the privileges of the user, the task might be in another business unit and not visible to the user, therefore you should consider adding an “assign step” that assigns the new task to the owner of the account. Now, if the workflow is executed on-demand, the workflow will then execute in the context of the user who requests the workflow execution. Because dialogs are always on-demand then they always execute in the context of the user who started the dialog.



Q2: Why does the process execute under different users depending on how it was started?

A2: This was a design decision based on security considerations. You don’t want to inadvertently be sending emails and executing actions without knowing it because some other user decided it. Therefore, by having this different behavior we can guarantee that the user under which the workflow executes is always aware that a workflow is performing some actions on his behalf. For the automatic workflow case, the owner of the workflow is also the person who activates it and who selects the trigger mechanism and the workflow steps so it is OK if the workflow executes under that user’s context. For the on-demand case, a user is specifically requesting some actions to be performed on his behalf by a workflow so the user is fully aware of the workflow definition and that it will execute; therefore it is safe to execute the workflow under that user’s context instead of the workflow owner (who might not be aware that a user requests an on-demand execution).



Q3: Why can’t I activate/deactivate someone else’s workflow, even if I am the system administrator?

A3: For the same security reason as explained above. You want the workflow owner to explicitly acknowledge that a workflow will be activated and will perform some actions on his behalf. You would not want to allow another user (even the system administrator) to decide that some process should be executed on another user’s behalf. If you want to activate/deactivate someone else’s process you must first assign it to yourself.



Q4: If I assign an activated process to another user, why does the user have to re-activate it?

A4: Active processes cannot be modified so the system automatically deactivates them before assigning it to the new user. As per Q3 above, only the new owner will be able to re-activate the process.



Q5: I am importing a solution that contains processes and it fails with this error message “The workflow cannot be published or unpublished by someone who is not its owner”. What is wrong?

A5: If your solution contains a process that already exists in the organization and is activated then solution import will attempt to update it. In order to do so, it must first deactivate it. However, if the owner of the activated process is not the same as the user who is importing the solution, then deactivating the process will fail (see Q3). Therefore you have a few options to fix this problem:

1.       Import the solution using the user who owns the activated process. This can be tricky, especially if there are multiple processes owned by different users which need to be updated by the solution import.

2.       Verify which processes are included in the solution, and then find them in the organization, if you can find them and they are not owned by you then you must assign them to yourself. You can reassign them to the original user after you import the solution; however, you will have to ask the process owners to activate it themselves.


6 comments:

  1. Thanks! This is just what I was looking for.

    ReplyDelete
  2. We are using on-demand workflows that create and modify tasks and appointments. We need the records that are created to reflect the proper Created By and Modified By as the person who ran the workflow. Currently, they show as Created and/or Modified by the person who owns the workflow.

    How do we fix that?

    Thanks,
    Karla

    ReplyDelete
  3. Hi, unfortunately, the behavior explained in this post is not customizable in CRM 2011. If the workflow is automatic, the records created will be owned by the workflow owner. You can always add an "assign" step in your workflow.

    ReplyDelete
  4. Hi Gonz,
    I am having few workflow with me I need to activate those workflow which are in draft state but the owner is someone else and has left the org. Con you guide me the steps to assign myself the owner of those workflow and activate them.

    ReplyDelete
  5. You can simply use the "assign" button, if you have enough privileges that is enough.

    ReplyDelete
  6. I'm finding that workflows that workflows that are currently 'Active' can't be re-assigned. The fields are greyed out and it seems workflow settings can't be modified. I had to ask the person that created the workflow to deactivate and re-assign to me.

    Any suggestions on if the person that created the workflow was not available or if they were no longer with the organization?

    ReplyDelete