locked
How to get the Owner of the process RRS feed

  • Question

  • Hello,

    I am currently working on a custom work flow assembly.

    I need to get the current owner of the process. But I used Conditionoperator.EqualuserID.

    My present code is

     set
                {
                    
                    usersettings currentUserSettings = (usersettings)crmService.RetrieveMultiple(
                   new QueryExpression("usersettings")
                   {
                       ColumnSet = new ColumnSet("timezonecode"),
                       Criteria = new FilterExpression
                       {
                           Conditions =
                            {
                               
                                new ConditionExpression("systemuserId", ConditionOperator.EqualUserId)
                     
                          
                            }
                       }
                   }
               ).BusinessEntities[0];
    }

    Is there any way to get the owner of the process (ie do I need to replace Conditionoperator.EqualuserID with something else to get the owner of the process)

    Thanks

    Monday, August 27, 2012 6:38 PM

Answers

All replies

  • If you need to find the owner of the workflow. Then you need to retrieve the ownerid field of the workflow entity. If you are trying to find out the initiating user who is trigger the workflow. You can find that out using (context.UserId); context.InitiatingUserId I hope this helps.

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Amreek Singh Senior Solution Architect HP Australia Sydney, Australia http://mscrmshop.blogspot.com http://crm2011usersettings.codeplex.com

    • Proposed as answer by Amreek Singh Monday, August 27, 2012 11:21 PM
    Monday, August 27, 2012 11:20 PM
  • Amreek Singh,

    Thanks for you reply.

    How can I bring the context in the set method?

    Is there a way to do that?

    Please help me as  I am a beginner.

    Thanks

    Tuesday, August 28, 2012 4:26 PM
  • If you are writing a workflow assembly, it is part of the function. System passes the context to the execute method of the workflow assembly.

    some thing like this

    (CodeActivityContext executionContext)

    I blog about a workflow assembly lat year. Have a look at that

    http://mscrmshop.blogspot.com/2011/05/how-to-set-date-fields-in-mscrm-2011.html

    I hope this helps.


    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Amreek Singh Senior Solution Architect HP Australia Sydney, Australia http://mscrmshop.blogspot.com http://crm2011usersettings.codeplex.com

    • Proposed as answer by Amreek Singh Tuesday, August 28, 2012 11:19 PM
    • Marked as answer by Only onek Monday, September 10, 2012 10:18 PM
    Tuesday, August 28, 2012 11:19 PM