locked
On opening a case or lead assign to current user RRS feed

  • Question

  • Hi,

    I would like to set the Owner field to the current user when a case or lead is opened. My workflow that turns an email into a case sets it to the workflow owner and even trying to set it to the Modified By in workflow doesn't work.

    Any suggestions most welcome.

    Regards

    Shaun

    Thursday, October 7, 2010 9:47 PM

Answers

  • If your workflow is executed manually, you can determine the "current" user (the user which has executed the Workflow) by using a bit of code I engineered to return that value .  It's a custom workflow activity that simply returns a reference to the user that executes the Workflow.  That's all it does.  You would assign the returned value from that step to the "Owner" field.

    If your workflow runs automatically, however, then you'll need some other way to define what "current" user means.


    Dave Berry - MVP Dynamics CRM - http:\\crmentropy.blogspot.com
    • Proposed as answer by Jeff Loucks Friday, October 8, 2010 12:34 AM
    • Marked as answer by Donna EdwardsMVP Thursday, October 14, 2010 1:13 PM
    Thursday, October 7, 2010 10:53 PM
    Moderator

All replies

  • If your workflow is executed manually, you can determine the "current" user (the user which has executed the Workflow) by using a bit of code I engineered to return that value .  It's a custom workflow activity that simply returns a reference to the user that executes the Workflow.  That's all it does.  You would assign the returned value from that step to the "Owner" field.

    If your workflow runs automatically, however, then you'll need some other way to define what "current" user means.


    Dave Berry - MVP Dynamics CRM - http:\\crmentropy.blogspot.com
    • Proposed as answer by Jeff Loucks Friday, October 8, 2010 12:34 AM
    • Marked as answer by Donna EdwardsMVP Thursday, October 14, 2010 1:13 PM
    Thursday, October 7, 2010 10:53 PM
    Moderator
  • By default a record created by a manually triggered workflow is set to the current user as owner.
    Jeff Loucks | Available Technology | 888-474-2237 | http://msmvps.com/blogs/jeffloucks
    Friday, October 8, 2010 12:33 AM
  • just create a cutom work flow as David suggested and use that in your manin workflow.
    yes.sudhanshu

    http://bproud2banindian.blogspot.com
    http://ms-crm-2011-beta.blogspot.com
    Friday, October 8, 2010 7:04 AM
  • I would like to note that while my post does contain helpful code for obtaining a reference to the user who executes a Workflow , which can be used in many ways not limited to the "Owner" field, Jeff Loucks advice is technically the most appropriate answer to this thread.
    Dave Berry - MVP Dynamics CRM - http:\\crmentropy.blogspot.com
    Thursday, October 14, 2010 8:22 PM
    Moderator