Resources for IT Professionals > Dynamics Forums > CRM Development > Publishing Workflow on behalf of other user on Premise CRM system
Ask a questionAsk a question
 

AnswerPublishing Workflow on behalf of other user on Premise CRM system

  • Friday, November 06, 2009 4:37 PMMayankP Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi All,

    we are using CRM system which deployed as on premise and all users is log on to CRM system using their windows credentials and we have not got access to their credentials.

    We have got the system used by different division and each division will have their own workflows...

    Workflow owner must be specific divisional manager so that only relevant workflow gets fire for their division only.

    I know that only owner of the workflow can publish the relevant workflow in CRM.

    So how do we publish the workflow on behalf of managers of division with CRM so that only relevant workflow gets fire for their division?

    Any ideas ?

Answers

  • Thursday, November 12, 2009 8:59 PMScott Sewell, CustomerEffectiveMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    MayankP -

    I think there may be some confusion here -

    Are you able to write a custom workflow activity using the SDK? - or are you trying to do this only through the CRM user interface?

    If you are only using the CRM user interface, you will not be able to 'impersonate' the manager - They will have to publish the workflow themselves.

    Otherwise, if (as suggested by David and David) you are writing a custom workflow step - See http://msdn.microsoft.com/en-us/library/cc151142.aspx for more information - you should be able to use this to impersonate the managers using the method that "The Davids" suggested.




    Scott Sewell, CustomerEffective | http:\\blog.CustomerEffective.com | Twitter:@ScottSewell

All Replies

  • Friday, November 06, 2009 6:15 PMDavidBerry Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    You might be able to whip up another Workflow with an custom activity that takes a target Workflow and user as parameters and calls the SetStateWorkflow message:

    http://msdn.microsoft.com/en-us/library/bb890234.aspx


    Dave Berry
    • Marked As Answer byJim Glass MSFTOwnerFriday, November 06, 2009 6:40 PM
    • Unmarked As Answer byMayankP Sunday, November 08, 2009 12:46 AM
    •  
  • Sunday, November 08, 2009 12:47 AMMayankP Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi david,

    as i said workflow is owned by some one else...doing this was comes back with following error......
    <error>
    <code>0x8004500b</code>
      <description>The workflow cannot be published by someone who is not its owner.</description>
      <type>Platform</type>
    </error>
  • Sunday, November 08, 2009 10:31 AMRob Boyers Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi MayankP

    Is it not feasible for you to temporarily give the divisional managers a security role with 'publish customizations' privilege?
    I suppose it depends on how many of these divisional managers there are but once they have published their workflows they would then have the privelige removed.
    NOTE: you cannot just set 'publish customizations' to true without also setting the write privilege to true for Entity, Attribute, Relationship, Form, and view.

    Rob
    CRM4 MBSS
  • Sunday, November 08, 2009 1:57 PMMayankP Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi Rob,

    problem is not related to security role because divisional manager have not "system administrator role"...(given this role for testing).....

     

    Problem is thate these manager ownes the wrokflow and we should be able to publish thier workflow...........unless we able to publish the workflow on thier behalf..my problem is not solved...(they can not publsih becuase they are not crm developer and not aware of internal crm system working. and we need to publish this out of the business hours and managers won't be available for this)

  • Monday, November 09, 2009 8:25 PMDavidBerry Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    MayankP,

    So I assume you were unable to successfully impersonate said owner of the Workflow, in order to programmatically publish it?
    Dave Berry
  • Thursday, November 12, 2009 10:41 AMMayankP Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    yes, I am not able to do any importonation in the custom workflow activity at all...

    is there any other way or any other idea to resolve this?

  • Thursday, November 12, 2009 12:32 PMDavidJennawayMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Have you tried using CRM impersonation when calling the SetStateWorkflow message. As long as your code runs under the context of an account in the PrivUserGroup, you should be able to set the CrmAuthenticationToken.CallerId property for each workflow owner in turn, and publish their workflows
    Microsoft CRM MVP - http://mscrmuk.blogspot.com  http://www.excitation.co.uk
  • Thursday, November 12, 2009 8:29 PMDavidBerry Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    That's what my suggestion was, and he seems to indicate that it fails.
    Dave Berry
  • Thursday, November 12, 2009 8:59 PMScott Sewell, CustomerEffectiveMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    MayankP -

    I think there may be some confusion here -

    Are you able to write a custom workflow activity using the SDK? - or are you trying to do this only through the CRM user interface?

    If you are only using the CRM user interface, you will not be able to 'impersonate' the manager - They will have to publish the workflow themselves.

    Otherwise, if (as suggested by David and David) you are writing a custom workflow step - See http://msdn.microsoft.com/en-us/library/cc151142.aspx for more information - you should be able to use this to impersonate the managers using the method that "The Davids" suggested.




    Scott Sewell, CustomerEffective | http:\\blog.CustomerEffective.com | Twitter:@ScottSewell