I am using beatbox
to access the SOAP API of Salesforce. More specifically, I am trying to convert a Lead
using convertLead
like so
# Assuming soap_client is a PythonClient already logged in and
# lead is a Lead object.
response = soap_client.convertLead({
'leadId': lead.pk,
'convertedStatus': "Qualified - converted",
})
According to the documentation this endpoint should not need any more parameter than leadId
and convertedStatus
, however the response contains the following error message
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Company_Name__c]: [Company_Name__c] (System Code)UNKNOWN_EXCEPTION00Qg0000003Er0pEACfalse
It is good to mention that lead
(the Lead
object to be converted) actually contains a non empty Company
field.
Any idea of what could cause this error message? I tried to specifically add a companyName
field to the API call but it did not help.
As per your explanation you are getting the error of Required fields are missing (Company_Name__c) and you tried to assign the value to this "companyName" field, But you are getting error for custom field not standard salesforce field.
So i think when you are converting it, then may be some account / contact custom field is required [Required fields are missing: [Company_Name__c]]. So you need to assign value of that field explicitly in your code.
If you want to map the custom field then please check below link :
https://help.salesforce.com/apex/HTViewHelpDoc?id=customize_mapleads.htm&language=en
Otherwise if you did not want to check required field on lead conversion then you can disable that using following steps : 1. Login to your salesforce org. 2. Setup 3. Customize 4. Leads 5. Settings 6. Edit and uncheck the "Require Validation for Converted Leads".