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

Syntax question on how to set a specific value in a specific field on service.update to all records returned to an EntityCollectoon

$
0
0

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




Viewing all articles
Browse latest Browse all 55831

Trending Articles



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