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
KR_ForceKR_Force 

Entity 'Owner' not accessible in version 30.0 at line 1 column 24

I tried in all API versions getting same error. any suggestion will be greathelfull
public without sharing class LeadXXXXXOwner {

public static List<Lead> leadXXXXXOwnerUpdate(List<Lead> nLst, Map<ID,Lead>oldMap){
        
        List<Lead>updLst= new List<Lead>();
        
        for( Lead l : nLst){
            Lead oldLead = oldMap.get(l.Id);
            if(Owner.profile.name.contains('XXXXX')|| Owner.name.contains('XXXXX')||Owner.profile.name.contains('XXXXX')|| Owner.name.contains('XXXXX')){
                l.Previous_Lead_Owner__c='XXXXXOwner::'+ Owner.Name;
            }
        }
        return updLst;
        
    }
}
 
Best Answer chosen by KR_Force
KR_ForceKR_Force
Never mind its a typo error.

All Answers

Zuinglio Lopes Ribeiro JúniorZuinglio Lopes Ribeiro Júnior
Hello,

What exactly you want to happen and what are the conditions?

Regards.
KR_ForceKR_Force
thanks for the response, I  want to update the Previous owner field when lead owner name or owner profile name contains 'marketing'.
Zuinglio Lopes Ribeiro JúniorZuinglio Lopes Ribeiro Júnior
Hello,

But what are the conditions? If a user updates a Lead you want to check if the user name or profile contains 'Marketing' and if true, you want to update lead's owner to the user that has updated it?
KR_ForceKR_Force
When ever the owner gets updated i have to check the Previous owner name and profile if one of them has marketing in the name or profile. I have to to update the Previous owner text field. Hope this make more sense to you.
KR_ForceKR_Force
Never mind its a typo error.
This was selected as the best answer