2010-03-10 39 views
3

更新:它按預期工作只需要通過正確的ID,DUH〜Salesforce的 - 更新/的Upsert自定義對象進入

我在Salesforce的自定義對象,有點像對一個案件的評論部分!例。當您添加一條新評論時,它會爲該條目添加一個日期/時間戳,我想在創建新的案例評論時更新之前的案例評論日期/時間戳。

我想做一個像這樣的UPDATE:

$updateFields = array(
       'Id'=>$comment_id, // This is the Id for each comment 
       'End_Date__c'=>$record_last_modified_date 
      ); 

function sfUpdateLastCommentDate($sfConnection, $updateFields) { 
    try {   
     $sObjectCustom = new SObject(); 
     $sObjectCustom->type = 'Case_Custom__c'; 

     $sObjectCustom->fields = $updateFields; 
     $createResponse = $sfConnection->update(array($sObjectCustom));    
    } catch(Exception $e) { 
     $error_msg = SALESFORCE_ERROR." \n"; 
     $error_msg .= $e->faultstring; 
     $error_msg .= $sfConnection->getLastRequest(); 
     $error_msg .= SALESFORCE_MESSAGE_BUFFER_NEWLINE; 

     // Send error message 
     mail(ERROR_TO_EMAIL, ERROR_EMAIL_SUBJECT, $error_msg, ERROR_EMAIL_HEADER_WITH_CC); 
     exit; 
    } 
} 

我也試過UPSERT,但我得到的錯誤:

Missing argument 2 for SforcePartnerClient::upsert() 

任何幫助將是巨大的

+0

呃,我想通了,是通過錯誤的Id。需要通過commentId但通過recordId – 2010-03-10 19:17:10

回答

1

咄,我想通了,是通過錯誤的Id。需要通過commentId但通過記錄Id

+0

謝謝,我有同樣的問題,你節省我的時間! – ygaradon 2012-12-03 23:59:20

相關問題