function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
zeezackzeezack 

Update through php?

Hi guys,

I use this phptool kit to insert stuff into salesforce... but how do you update?

 

 

insert

 

 
                        /** Salesforce Claim Object maker **/
                            $sObjects_insert = array();    
                            $sObject = new sObject();
                            $sObject->type = 'Claim__c';
                            
                            $sObject->fields = array(
                                'Primary_Account_Holder__c' => $accountid,
                                'Debt_Type__c' => $debt_type,
                                'Agreement_Start_Date__c' => $agreement_start_date,
                                'Amount_Of_Debt__c' => $amount_of_debt,
                                'X12_Months_Remaining_On_Debt__c' => $months_remaining_on_debt,
                                'Claim_Status__c' => $claim_status,
                                'Claim_Payment_Result__c' => $claim_pay_result,
                                'Agreement_Ref_Acc_No__c' => $agreement_ref_acc_no,
                                'Lender__c' => $lender,
                                'Does_Agreement_Have_PPI__c' => $agreement_have_PPI,
                                'Introducer_Claim_Ref__c' => $introducer_claim,
                                'Previous_Address__c' => $previous_address,
                                'Claim_Challenge__c' => $claim_challenge,
                                'Secondary_Account_Holder__c' => $secondary_account_holder,
                                'Introducer__c' => $introducer,
                                'Premier_Introducer__c' => $grandparent,
                                'Introducer_Sales_Agent__c' => $contact,
                                'Claim_Type__c' => $Claim_Type__c                        
                            );
                            
                            array_push($sObjects_insert, $sObject);
                            flush();
                            print_r($createResult);
                            
                            //if there are objects to insert then do it.                
                            if (count($sObjects_insert) > 0)
                            {
                                 $createResult = $mySforceConnection->create($sObjects_insert);                        
                            }                
                        /** Salesforce Claim Object maker **/

NBlasgenNBlasgen

$sObject = new SObject();

$sObject->fields = array(

   'Id' => $sfdc_object_id,

   '....' => ....,

   '....' => .....

  );

$sObject->type = 'Lead';

$sfdc_connection->update(array($sObject));

 

I'm just writing that by hand so it might not work correctly.  Update is just like creation except you need to specify the Id field and Type.  The above example is using the Partner API.  Enterprise would be different.