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
Kemp100Kemp100 

New to Salesforce, Please advice on Creating a Lead

I am trying to create a lead and i am using using the WSDL file that came with the package. Do i need to get my own Customized one? If so, where can i get this.

After that, I have this code to LOGIN and Create a lead, but its not working...Can someone help. I am using PHP

//Login
    $mySforceConnection = new SforcePartnerClient();
    $mySforceConnection->createConnection($wsdl);
    $loginResult = $mySforceConnection->login($username, $password);

    $fieldsToAdd = array( 'Name' => $name, 'BillingCity' => $ct, 'BillingState' => $st, 'Phone' => $phone, 'Fax' => $fax );
    $sObject = new SObject();
    $sObject->fields = $fieldsToAdd;
    $sObject->type = 'Lead';
    $add = $mySforceConnection->create( array( $sObject ) );

for some reason i get a INVALID_TYPE: sObject error on that.

Can someone tell me why that is not working..and also, once i add it..how can i check to see if it actually ADDED..

--thanks

Park Walker (TAGL)Park Walker (TAGL)
Make sure that you are using the Partner WSDL if you are using the PHP toolkit.

You may want to use the Enterprise WSDL as a reference document for object and field names. If you check the Lead object you will see that the field names that you are using are incorrect. The Billing* fields do not exist in the Lead object. Uisng just 'City' and 'State' should provide better results.