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
Sowjanya Hegde 13Sowjanya Hegde 13 

Fetch the Lead owner upon Lead conversion

I have created Lead and I have set the Lead owner as Queue. Then I converted Lead to Opportunity. Now If I check the Lead owner it shows logged in user(myself) as a Lead owner. How can I fecth the actual lead owner(QUEUE) after lead conversion ? Please help!
Best Answer chosen by Sowjanya Hegde 13
Sowjanya Hegde 13Sowjanya Hegde 13

I was able to fetch the ownerId after the conversion of the Lead with the following code:

if (Trigger.isBefore) {
   if (Trigger.isUpdate) {
   for (Lead ld : Trigger.new) {
      Lead leadDetail = trigger.oldmap.get(ld.Id);
      Id ownerIdBeforeConvert = leadDetail.OwnerId;
   }
 }
}

All Answers

ShirishaShirisha (Salesforce Developers) 
Hi Sowjanya,

Greetings!

The Lead owner will be changed to the user who converted the Lead after converion as per the below article.

https://help.salesforce.com/articleView?id=000328720&type=1&mode=1

Please mark it as best answer if it helps you to fix the issue.

Thank you!

Regards,
Shirisha Pathuri
Sowjanya Hegde 13Sowjanya Hegde 13

I was able to fetch the ownerId after the conversion of the Lead with the following code:

if (Trigger.isBefore) {
   if (Trigger.isUpdate) {
   for (Lead ld : Trigger.new) {
      Lead leadDetail = trigger.oldmap.get(ld.Id);
      Id ownerIdBeforeConvert = leadDetail.OwnerId;
   }
 }
}

This was selected as the best answer