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
MXGMXG 

Set IsConverted to true

Hi Community,
I want to set the IsConverted (=true) variable of a Lead, but it is a readonly field...

We are creating leads, opportunities, contacts and accounts via api and we want to set the lead as converted. Is there a way to do this via api? I found the LeadConvert class, but this class will merge informations and I can not disable the option to create a new opportunity.
I hope someone could help me. Thanks.
Naval Sharma4Naval Sharma4
No, you can't set this field as it's read-only. You can use existing opportunities and contact records to specify them while converting lead using API. Doing so will not create any record.
MXGMXG
Thanks for your answer. How do you mean it? How can I specifiy opportunities and contacts while converting a lead?
Tad Aalgaard 3Tad Aalgaard 3
What about using isDoNotCreateOpportunity() in the LeadConvert class?

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dml_convertLead.htm