You need to sign in to do that
Don't have an account?
UPSERT NOT WORKING!!!
I'm using C# to call the Salesforce API. I have a custom object with many custom fields. I instantiate my custom object, and set all of the fields, and then send an upsert command with that object.
Every field saves just fine... EXCEPT THE FIELD WITH A DATETIME TYPE!!! I don't get it. It forces me to save a DateTime object to that field, but never saves it.
The upsert finishes with no errors. And like I said before: Every field is saved EXCEPT the dateTime field.
What is the problem?
Here is the code:
for (int i = 0; i < data.Length; i++)
{
sforce.Time__c[] time = new Time__c[1];
time[0] = new sforce.Time__c();
Dictionary<string, Object> dataRow = (Dictionary<string, Object>)data[i];
foreach (KeyValuePair<string, Object> dataEntry in dataRow)
{
time[0].id__c = Convert.ToString(dataEntry.Value);
// HERE IS WHERE IS SET THE DATETIME. IT GETS STORED HERE, BUT NEVER SAVED AFTER UPSERT
time[0].date__c = Convert.ToDateTime(dataEntry.Value);
time[0].time__c = (string)dataEntry.Value;
}
// THE UPSERT SAVES ALL OTHER FIELDS, BUT IGNORES THE DATETIME. NO ERRORS ON UR
sforce.UpsertResult ur = binding.upsert("id__c", time)[0];
}
You need to set the specified flags that .NET adds. see
http://community.salesforce.com/sforce/board/message?board.id=NET_development&message.id=815
All Answers
You need to set the specified flags that .NET adds. see
http://community.salesforce.com/sforce/board/message?board.id=NET_development&message.id=815