Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Modifying Account field value via API changes Ownership

$
0
0

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();
}


Viewing all articles
Browse latest Browse all 46379

Trending Articles