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
Cassandra WitCassandra Wit 

Lead Ownership Change Validation Rule

Happy Holidays - how do I created a validation rule where users with a specific profile can only change leads that are in a queue or that belong to them but do not belong to any other user. The below blocks them from changing leads from other sales people but still allows management to change owners but it also blocks them from hanging leads owned by a queue. how do I correct? 

AND(
ISCHANGED( OwnerId ), 
PRIORVALUE(OwnerId) <> $User.Id,  
$Profile.Name <> "Sales & Service Managers",
$Profile.Name <> "System Administrator",
$Profile.Name <> "Marketing Pardot User",
$Profile.Name <> "JumpCrew Marketing User"
)

Thank you! 
Best Answer chosen by Cassandra Wit
Akhil AnilAkhil Anil
Hi Cassandra,

The below formula should rectify the blockage for hanging leads in the queue.
 
AND(
LEFT(PRIORVALUE(OwnerId),3) <> "00G",
ISCHANGED( OwnerId ), 
PRIORVALUE(OwnerId) <> $User.Id,  
$Profile.Name <> "Sales & Service Managers",
$Profile.Name <> "System Administrator",
$Profile.Name <> "Marketing Pardot User",
$Profile.Name <> "JumpCrew Marketing User"
)

Kindly test and let me know how it goes.

All Answers

Akhil AnilAkhil Anil
Hi Cassandra,

The below formula should rectify the blockage for hanging leads in the queue.
 
AND(
LEFT(PRIORVALUE(OwnerId),3) <> "00G",
ISCHANGED( OwnerId ), 
PRIORVALUE(OwnerId) <> $User.Id,  
$Profile.Name <> "Sales & Service Managers",
$Profile.Name <> "System Administrator",
$Profile.Name <> "Marketing Pardot User",
$Profile.Name <> "JumpCrew Marketing User"
)

Kindly test and let me know how it goes.
This was selected as the best answer
Cassandra WitCassandra Wit
That worked, or seems to have worked. I had two users with different profiles test it and it functioned as planned. Thank you for your help!. Cassandra Wit Sr. Operations Manager |502.387.2007 [cid:image001.png@01D235C9.7A48B690]
Akhil AnilAkhil Anil
Glad to hear that Cassandra. Kindly mark it as an answer so that we can close this thread.
Cassandra WitCassandra Wit
Update – this is not working anymore – any other suggestions on what changes to the code I need to make? Cassandra Wit Sr. Operations Manager |502.387.2007 [cid:image001.png@01D235C9.7A48B690]
Akhil AnilAkhil Anil
Hi Cassandra,

Can you elaborate the scenarios for which the rule is NOT working ?