4

I am getting an issue:

REQUIRED_FIELD_MISSING, Converted objects can only be owned by users. If the lead is not owned by a user, you must specify a user for the Owner field.: [OwnerId] while converting a lead by database.leadconvert().

Anyway, I need to convert this lead. Any suggestion would be helpful.

5

When converting leads owned by a queue, the owner must be specified. This is because accounts and contacts cannot be owned by a queue. Even if you are specifying an existing account or contact, you must still specify an owner.

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

So, the answer is to set the OwnerId on your LeadConvert object using the setOwnerId(ownerId) method.

Here's the documentation for LeadConvert class - https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dml_convertLead.htm

If you need additional help, please provide your code in your question above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.