function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
IWyattIWyatt 

C# - Update 'OwnerID' on unknown object type

Hey everyone,

 

I have a utility that I use to update the 'OwnerId' field on the Lead Object, but I want to make it flexible enough to handle all sorts of salesforce objects.

 

How can I repalce the "sf.Lead" in the foreach statement to match the object type of the "sfobjects" array?

 

 

sf.sObject[] sfobjects = binding.retrieve("ID, OwnerId", objecttype, objectids); foreach (sf.Lead sfobject in sfobjects) //need to change this to any object type { sfobject.OwnerId = "005000000071z0V"; binding.update(new sObject[] { sfobject }); }

 

 

Thanks,

Isaac

 

SuperfellSuperfell
For generic any sobject code like this, the partner WSDL is the way to go.