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
AbAb 

Find profile of lead owner, possible without query

Hello,

How can i get the profile of owner in an apex code.
Ideally from the old map of trigger.

I have Trigger.oldMap:
for(Lead l : Trigger.oldMap){
    l
}

Thank you for sugestion
Best Answer chosen by Ab
Khan AnasKhan Anas (Salesforce Developers) 
Hi,

Greetings to you!

Unfortunately, you can't do that. The trigger has all the direct fields of the object but not those available through relationships. trigger.new and trigger.old always give the current object field value.

You will have to query the database for the same. Please refer to the below link which might help you further.

https://developer.salesforce.com/forums/?id=906F0000000BVDqIAO

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas