Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Modifying Account field value via API changes Ownership

Posted on by Microsoft Employee

I am using the CRM SDK (8.1) connecting to an instance of CRM Online. I have a custom field (text) that is updated on the Account entity. Unexpectedly, this changes the Owner of the Account. Please help me understand why this is occurring and if their is someway to NOT change the Owner for this one field value update.

--JD Montogomery

Below is my relevant code;

using (_serviceProxy = new OrganizationServiceProxy(serverConfig.OrganizationUri,
serverConfig.HomeRealmUri, serverConfig.Credentials, serverConfig.DeviceCredentials))
{
_serviceProxy.EnableProxyTypes();

_service = (IOrganizationService)_serviceProxy;
var ctx = new OrgService(_service);

var opps = (from o in ctx.OpportunitySet
where o.AccountId != null && o.new_DOT != null
orderby o.new_DOT
select o).ToList();
foreach (var opp in opps)
{
var account = (from a in ctx.AccountSet
where a.Id == opp.CustomerId.Id && a.po_DOT != opp.new_DOT
select a).SingleOrDefault();
if (account == null)
{
continue;
}

account.po_DOT = opp.new_DOT.Trim();
ctx.UpdateObject(account);
}
ctx.SaveChanges();
}

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Modifying Account field value via API changes Ownership

    My problem description is incorrect;

    Unexpectedly, this changes the Owner of the Account.

    What I should have said;

    Unexpectedly, changing the text field value on the Account modifies the Owner of any Opportunity related to the account.

    I have made sure there is no customization on the Account that would cause this behavior.  I am aware of the System 1:N Referential Relationship on the Account entity, opportunity_parent_account, but do not understand how it might be affecting me since Assign is set to Cascade None.

    --JD

  • Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Modifying Account field value via API changes Ownership

    Is there any other custom logic is there on account entity, any workflow/custom code ?? did you check that ??

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans