我试图通过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