You need to sign in to do that
Don't have an account?
Prophyt
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.
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);