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
Anu_gAnu_g 

Problem when creating a contact with account name

I am new to the SalesForce.I have downloaded the PHP toolkit and was trying to create a Contact which includes the Account details

This was the code i have tried

$mySforceConnection = new SforcePartnerClient();
  $sforceSoapClient = $mySforceConnection->createConnection($wsdl);
  $mySforceConnection->setEndpoint($location);
  $mySforceConnection->setSessionHeader($sessionId);

    $FirstName = "sample";
    $LastName = "Test";
    $MailingStreet = "xxx";
    $MailingCity = "yyy";
    $MailingState = "zzzz";
    $MailingCountry = "India";
    $MailingPostalCode = "500 081";
    $Phone = "9886754427";
    $Email = "test@gmail.com";
    $LeadSource = "Web";
    $Languages__c = "English";
    $Level__c = "Primary";
    $Account = "xxx account name";
    $fieldsToCreate
      =array('FirstName'=>$FirstName,'LastName'=>$LastName,'MailingStreet'=>$MailingStreet,'MailingCity'=>$MailingCity,'MailingState'=>$MailingState,'MailingCountry'=>$MailingCountry,'MailingPostalCode'=>$MailingPostalCode,'Phone'=>$Phone,'Email'=>$Email,'LeadSource'=>$LeadSource,'Languages__c'=>$Languages__c,'Level__c'=>$Level__c,'Account=>$Account);
    $sObject = new SObject();
    $sObject->fields = $fieldsToCreate;
    $sObject->type = 'Contact';
    $acct = $mySforceConnection->create(array ($sObject));


When working with this code getting an error

SoapFault Object ( [message:protected] => INVALID_FIELD: No such column 'Account' on entity 'contact'. [string:private] => [code:protected] => 0 [file:protected] => C:\wamp\www\php toolkit\soapclient\SforceBaseClient.php [line:protected] => 324 [trace:private]

Please help me regarding this,of how can i include the account info when creating a contact

Thanks in Advance
zakzak
You specify the accountId, not the account name (account names are not unique)
Anu_gAnu_g
Thanks Zak,
                 Its working now