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
ProphytProphyt 

C# Update Contact Sample

I am working on creating some tools for our users and have run into a bit of a problem.  I need to be able to update a Contact record, a single Date field, to the current date at the time the tool is run.  I know how to handle the data but I am unable to figure out how to get a simple Update working properly.
 
I have a field, Last_Submission__c
It is a field in the Contact record
I will know the Id, Name, Email, anything that is required to update it.
 
Does anyone have a simple sample that will update a single Contact record?  Rather then digging through other elaborate samples I am hoping someone can do a simple start-to-finish run through on the method used to achieve this 'properly' that I can start over from.
 
I have been through the various samples available as well as ~70 posts here about the same topic but I am not finding anything that helps.
 
I appreciate any assistance you can offer.  Thanks.
SuperfellSuperfell
I'll asume you've already worked out how to login and set the sessionId / serverUrl up.


Contact c = new Contact();
c.Id = "<the Id>"
c.Last_Submission__c = DateTime.Now;
c.Last_Submission__cSpecified = true; 
SaveResult sr = binding.update(new SObject[] {c})[0];
if (sr.success)
   Console.WriteLine("Wahoo!");
else
  Console.WriteLIne("boo : {0} {1}", sr.Errors[0].statusCode, sr.Errors[0].message);

ProphytProphyt
Thank you SimonF.  Exactly what I wanted.  Been working on this tool for 18 hours straight and I think Im just tired of staring at the same stuff :)  I appreciate your amazing response time.