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
Durai MuruganDurai Murugan 

Getting Error while create a lead using api with customise field

Hi,
I have created a custom field for lead and tried to create a lead using api by php on my developer account,but i got below error,please give the solution anyone. i have alos added the _c  on the field but get same error.like lead_created_date_c
Exception INVALID_FIELD: No such column 'lead_created_date' on entity 'Lead'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

Screenshot attached:
User-added imageUser-added imageUser-added imageUser-added image
php parameters,
$wsdl = 'soapclient/partner.wsdl.xml';
# Salesforce Create New Lead 
    $records = array();
    $records[0] = new SObject();
    $records[0]->type = 'Lead';
    $records[0]->fields = array(
        'FirstName' => 'demouser',
        'LastName' => 'S',
        'Title' => 'SE',
        //'LeadSource' => WEB_APP_NAME,
        'LeadSource' =>'Web',
        'Company' => 'ggg',
        'NumberOfEmployees' => 10,
        'Email' => 'demouser@yopmail.com',
        'Phone' => '9899999998',
        'MobilePhone' => '9111111111',
        'lead_created_date' => '12/11/2018'
    );


Is it correct?please suggest.

Thanks
SandhyaSandhya (Salesforce Developers) 
Hi,

If this is a new field created after you had consumed the wsdl in your dev environment then you may need to regenerate the wsdl and re-consume it as the field definition will not be in the wsdl file generated prior to the field creation.
 
   Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
                                             
Best Regards
Sandhya
 

 
Durai MuruganDurai Murugan
Hi Sandya,
Thanks for your reply.  have regenerated the following files metadata.wsdl, enterprise.wsdl, partner.wsdl. now i seeing the lead_created_date__c in the enterprise.wsdl within  <complexType name="Lead"> tag. i am also passing parameter like 'lead_created_date_c' =>   gmdate( "Y-m-d\TH:i:s.000\Z" ) from php code. but getting same error. can you please provide any urls or demo. it will helpful.

Thanks&Regards,
Durai 
Durai MuruganDurai Murugan
Hi Sandya,

Now its working fine. Thanks

Thanks&regards,
Durai
Durai MuruganDurai Murugan
Hi,

Another one help. is it possible to remove the "Lastname" unique validation from lead field. If yes how can i do that.

User-added image

Thanks&regards,
Durai