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

crm plugin The entity is read-only and the 'EntityState' property cannot be modified. Use the context to update the entity instead

$
0
0

Hi,

My code:

myEntity= (from t in xrmContext.MyEntitySet
where t.myEntityId == myEntityId .lookUpField.Id
select new MyEntity()
{
myEntityId = t.myEntityId,
field1=t.field
}).FirstOrDefault();
myEntity.EntityState = EntityState.Changed;
service.Update(myEntity);

In the line myEntity.EntityState = EntityState.Changed; 

I get an error: The entity is read-only and the 'EntityState' property cannot be modified. Use the context to update the entity instead.

What should I do?

thanks!


Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>