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
mageshwari s 7mageshwari s 7 

convert lead

We need to convert lead via Api. I couldn't find the api so if anyone knows let me know please.
1.I have tried manually to convert lead process like first create account for lead companyname,then use that created account-id create new contact.
2.finally updating those fields via[https://ap16.salesforce.com/services/data/v46.0/sobjects/Lead/{ID}?_HttpMethod=PATCH](ConvertedContactId, ConvertedAccountId, ConvertedDate, IsConverted, ConvertedOpportunityId).
3.For the above request i got below Error message show like this("message": "Unable to create/update fields: ConvertedContactId, ConvertedAccountId, ConvertedDate, IsConverted, ConvertedOpportunityId. Please check the security settings of this field and verify that it is read/write for your profile or permission set.",
        "errorCode": "INVALID_FIELD_FOR_INSERT_UPDATE")
Sunad RasaneSunad Rasane

Hi, mageshwari, 

You cannot update the above-mentioned fields, these fields are auto-populated when we convert a lead manually or through the apex.
The apex example of lead conversion is given here- https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dml_convertLead.htm

Please reply if it helps and make sure to mark it as the best answer so it will be helpful for others.
Thanks

mageshwari s 7mageshwari s 7

Hi, Sunad Rasane,

Thank you for your response. we need to perform convert lead from outside salesforce so that we are checking the possibility of convert lead via API.
Is there any possibility using incoming webhook in salesforce? and if there is a chance i would trigger apex function from externally and another question is how to create apex function by externally.