0 votes
1 view
in Salesforce by (11.9k points)
edited by

I have a custom object in salesforce, kind of like the comments section on a case for example. When you add a new comment it has a date/time stamp for that entry, I wanted to update the previous case comment date/time stamp when a new case comment is created.

I wanted to do an UPDATE like this:

$updateFields = array(

                'Id'=>$comment_id, // This is the Id for each comment



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();


        // Send error message





I've also tried the UPSERT but I get the error:

Missing argument 2 for SforcePartnerClient::upsert()

Any help would be great

1 Answer

0 votes
by (31.8k points)
I think you're passing the wrong ID. You need to pass the commentID instead of recordID.
Welcome to Intellipaat Community. Get your technical queries answered by top developers !