我試圖通過SalesForce API(Enterprise WSDL)更新記錄。更新無法在SalesForce API中工作
下面的代碼執行得很好,並且返回的saveResult表示操作成功。
但是,當我查看SalesForce時,記錄尚未更新。我唯一能想到的就是我使用了錯誤的Id--但是我有五重檢查並重新檢查了它,然後重新檢查了它。
有沒有人遇到過這樣的事情?另外,我會非常高興,如果有人能指出愚蠢的錯誤,我可能做的地方:-)
sforce.Participant__c updateParticipant = new sforce.Participant__c();
updateParticipant.Id = participant.Id.Length == 15? participant.Id : participant.Id.Substring(0, 15);
if (updateType == "pre")
{
updateParticipant.Manual_Download_Date__c = DateTime.Now;
updateParticipant.Manual_Download__c = true;
}
else if (updateType == "post")
{
updateParticipant.Post_Class_Manual_Download__c = true;
updateParticipant.Post_Class_Manual_Downloaded_Date__c = DateTime.Now;
}
sforce.SaveResult[] result = SFLib.sfdc.update(new sforce.sObject[] { updateParticipant });
if (result == null || result.Length <= 0)
return false;
else
{
if (result[0].success == true)
return true;
else
throw new Exception("Update participant failed", new Exception(result[0].errors[0].message));
}
你應該給出下面的答案,並接受你自己的答案,以避免這個問題開放。 – mmix 2012-03-01 17:12:01