I can create lead via salesforce php api toolkit , by my client said every lead should be associated with a campaign , and he gave me a campaign id . The campaign id is similar to something like this "701g0000000Irtl" . I tried something like this

 $records = array();
 $records[0] = new stdclass();
 $records[0]->FirstName= $user_first_name;
 $records[0]->LastName= $user_last_name;
 $records[0]->Email= $user_email;
 $records[0]->Company= 'MYCompany';
 $records[0]->PostalCode= $current_user_zip;
 $records[0]->Newsletter_Signup__c= $news_letter_sign_up;
 $records[0]->Campaign= "701g0000000Irtl";
 $response = $mySforceConnection_enterprise->create($records, 'Lead');

But it doesn't a crate a lead with a campign id . But If I remove the line $records[0]->Campaign= "701g0000000Irtl"; It works fine , it create a lead in salesforce without any campaign associated with it .


Try using "Campaign_ID" instead of "Campaign" And don't forget to include "member_status" to give the campaign member, well, a status.

  • I tried the "Campaign_ID" , but it gives an error "No such column 'Campaign_ID' on entity 'Lead'. " May 12 '15 at 3:57
  • Try "CampaignID"? That's all I can think of. May 12 '15 at 5:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.