Tôi đang cố cập nhật bản ghi thông qua API SalesForce (Enterprise WSDL).Cập nhật không hoạt động trong SalesForce API
Mã bên dưới thực thi tốt và saveResult trả về cho biết rằng thao tác đã thành công.
Tuy nhiên, khi tôi nhìn vào SalesForce - bản ghi chưa được cập nhật. Điều duy nhất mà tôi có thể nghĩ đến là tôi đang sử dụng sai Id - Nhưng tôi đã quintuple kiểm tra này và kiểm tra nó một lần nữa và sau đó kiểm tra lại nó.
Có ai đã gặp phải điều gì đó như thế này trước đây không? Ngoài ra, tôi sẽ rất vui nếu ai đó có thể chỉ ra những sai lầm ngu ngốc mà tôi đã có thể làm ở đâu đó :-)
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));
}
bạn nên đưa ra câu trả lời bên dưới và chấp nhận câu trả lời của riêng bạn để tránh để câu hỏi này mở. – mmix