1. Ray

    $this->account_id = $response[0]->id);

    should be:

    $this->account_id = $response[0]->id;

    in create_contact() function

  2. ahmeddirie

    Thanks Ray! That was a good catch! Never saw that extra parenthesis.

  3. Sajeewa

    thanks ahmeddirie

  4. Mahendra Singh Panwar

    Hi Ahmeddirie,
    This is great help for learner/beginners.. Keep posting and enjoy life…
    -Mahendra Singh

  5. Mahendra Singh Panwar


    “SELECT Id,Name,MODEL__c, Brand__c ,Brand__r.name ,Product_Model__r.Id, Product_Model__r.name, Product_Description__c, Location__r.id, default_service_provider__c from Equipment_at_Store__c limit 2″

    I run this query with below code
    $response = $mySforceConnection->query($query);
    $queryResult = new QueryResult($response);
    if ($queryResult->size > 0) {
    $records = $queryResult->records;
    echo “”;
    foreach ($queryResult->records as $record)
    $sObject = new SObject($record);

    /*echo “”;
    //echo “”;
    echo “”;* /

    $name= $record->Equipment_at_Store__c->Name;
    $model= $sObject->fields->MODEL__c;
    $brand_id= $sObject->fields->Brand__c;
    $product_description= $sObject->fields->Product_Description__c;
    $default_provider = $sObject->fields->Default_Service_Provider__c;
    foreach($sObject->Brand__r as $item)
    $brandname= $item->Name;
    $post_data = array(‘product_desc’ => $product_description,
    ‘brand_name’ => $brandname,
    ‘model_name’ => $model,
    ‘serial_no’ => ‘234567892345’,
    ‘default_service_provider_id’ => $default_provider,
    ‘brand_id’ => $brand_id,
    ‘Name’ => $name

    $alldata = json_encode($post_data);


    But it doenot return __r columns and __c properly how can I get these data in PHP code.

    I can see entire record in Last_response object , and i believe we can’t use to get data.

    Any idea??
    Mahendra Singh

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>