Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

CRM 2011 - CreateOnBehalfOf using SDK

Posted on by Microsoft Employee

Hello -

I am trying to create an account in Dynamics via SDK. I'm creating a proxy as a different user to "createonbehalfof"... like this.

http://www.powerobjects.com/2012/08/06/how-to-impersonate-in-microsoft-dynamics-crm/

I'm setting the caller ID to one user, but the account is still being CREATED BY the service account hooked up through the service.

In our production environment, it works fine. In Beta, it is replicating like described above. What debugging techniques can i perform? In 

*This post is locked for comments

  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CRM 2011 - CreateOnBehalfOf using SDK

    Few options:

    1.Changing the settings in plugin steps (run as user, execution user whatever...)

    2.Modify the plugins code for execution user

    IOrganizationService service = factory.CreateOrganizationService(<USERID>);

    3.If it is just createdby, you can try assign value to the overwrite createdby field (you need to grant some privilege). Try google you will find the answer.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CRM 2011 - CreateOnBehalfOf using SDK

    Yeah.. plugins look to be the exact same between the two environments. Any other suggestions?

  • Suggested answer
    Emre GULCAN Profile Picture
    Emre GULCAN 2,379 on at
    RE: CRM 2011 - CreateOnBehalfOf using SDK

    Hi,
    You don't need code to check "user context" that I told. Just use Plugin Registration Tool and find your related plugin and step, after that check "Run in User’s Context" property inside Plugin Registration Tool.

    You can also reverse eng. your assemblies however I'm not sure about their health. You can check "Assembly Recover Tool" and also https://crmbusiness.wordpress.com/2015/08/13/crm-2015-how-to-decompile-plugin-code/ 

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CRM 2011 - CreateOnBehalfOf using SDK

    Hi -

    thank you for the suggestion! Unfortunately, i cannot dig into the plugins more than i can see in the sdk message processing steps. i'm unsure of how to open them. and i'm not sure which revision of our code is deployed. Is there a way to reverse engineer these plugins and pull the code out of what's actually in dynamics?

  • Suggested answer
    Emre GULCAN Profile Picture
    Emre GULCAN 2,379 on at
    RE: CRM 2011 - CreateOnBehalfOf using SDK

    Hi,

    Did you check your plugin's "Run in User’s Context" property, maybe this is not "Calling User".

    Please check this msdn.microsoft.com/.../hh237515(v=crm.6).aspx

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans