function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
String AccOwnerLkp=[Select AccountLookup__r.OwnerId from lead]; select name, AccountLookup__r.OwnerId, ownerid from lead where ownerid <> : AccOwnerLkp
select name, AccountLookup__r.OwnerId, ownerid from lead where (ownerid <> AccountLookup__r.OwnerId)
Store the lookup relationship field in any variable and compare it. like below
the above code will work.
hope this helps you.
Thanks
karthik
https://help.salesforce.com/articleView?id=000187460&type=1
One solution is a new formula field that will compare fields and return a value (like true or false) which you may use in a WHERE clause.
Formula field (checkbox): IsNotEqualOwnerWithAccountOwner__c : IF(ownerid != AccountLookup__r.OwnerId, true, false)
select name, AccountLookup__r.OwnerId, ownerid from lead where IsNotEqualOwnerWithAccountOwner__c = true