+ Start a Discussion

Create with Custom fields

I'm working with PHP5 and the Partner API.  I'm creating a lead through the API and so far it's working with the standard fields, but none of the custom fields work.  I thought I had read that I could use the custom fields by name but that didn't work so I used the ugly names "00234239847" and that gives me this error:
The content of elements must consist of well-formed character data or markup.
I read in another forum that this was taken care of, but it still seems to be a problem.
any help will be appreciated.
Tran ManTran Man
This worked for me:

  $createFields = array (
    'FirstName' => 'First',
    'LastName' => 'Last',
    'Company' => 'Test Co',
    'SICCode__c' => '9999',
  $createResponse = $mySforceConnection->create('Lead', $createFields);
where SICCode__c is my custom field.  Try printing out the createResponse.



The "__c" for custom fields works perfeclty.  I can't find that anywhere in the documentation.  It would be nice if it were in there.

The valid list of fieds for your login are available via the describeSobject call, which will include the __c suffix for custom fields.