+ Start a Discussion
etessetess 

Rule for Who Can Change an Opportunity Owner

I would like to create a validation rule that permits only Standard Users or Opportunity Owners to be able to change the ownership of an Opportunity. I created the following Validation rule on Opportunity owner:

 

 

AND(ISCHANGED( OwnerId ) , NOT(OR($Profile.Name == 'Standard User', OwnerId == $User.Id )))

 

 

However, it's not working. My test (on a System Admin profile) was to change an Opportunity not owned by me to me. I think it is failing because OwnerId is refering to the NEW value of the Opportunity Owner field, rather than the old value.

 

How do I get this working?

Best Answer chosen by Admin (Salesforce Developers) 
Steve MolisSteve Molis

Give this one a try

 

AND(
ISCHANGED(OwnerId),
PRIORVALUE(OwnerId) <> $User.Id,
NOT($Profile.Name = "System Administrator"))

 

 

All Answers

Steve MolisSteve Molis

Give this one a try

 

AND(
ISCHANGED(OwnerId),
PRIORVALUE(OwnerId) <> $User.Id,
NOT($Profile.Name = "System Administrator"))

 

 

This was selected as the best answer
etessetess

Aha! It was that PRIORVALUE function I was looking for. Thank you

Steve MolisSteve Molis

No problem, you owe me a beer!   Oh yeah, and I like to drink these->