I have a plugin that grabs a bunch of records from another entity and stores those records in an entity collection.
I need to somehow update a specific field in all those records named “my_autonumberattributename” in so that the value of that field is set to “0” in all of them.
My question is how can I edit the code below so that value 0 is inserted into the field named “my_autonumberattributename” for all the records that were returned to the EntityCollection MyReturnedRecords?
I think I am off to a good start with that foreach loop, but how to craft the service.update(e) statement is the problem.
Any help would be greatly appreciated.
EntityCollection MyReturnedRecords = service.RetrieveMultiple(query);
if (MyReturnedRecords.Entities.Count > 0 && MyReturnedRecords.Entities[0].Contains("my_autonumberattributename"))
{
foreach (Entity e in MyReturnedRecords.Entities)
{
service.Update(e);
}