1

I'm trying to create a validation rule to prevent 'portal' profile users to change ownership of lead record but they should be able to accept leads from 3 particular queues.

OR(
    AND(ISCHANGED( OwnerId ), 
    $UserRole.Name = 'Portal', 
    PRIORVALUE(OwnerId) <>'00G1r000003Bhko'), 
    AND(ISCHANGED( OwnerId ), 
    $UserRole.Name = 'Portal', 
    PRIORVALUE(OwnerId) <>'00G1r000003Bhkm'), 
    AND(ISCHANGED( OwnerId ), 
    $UserRole.Name = 'Portal', 
    PRIORVALUE(OwnerId) <>'00G1q000001DzGV')
)

3 Answers 3

1

well, It worked when I shuffle around it.

OR( 
AND( 
AND( 
AND(ISCHANGED( OwnerId ), 
$UserRole.Name = 'Portal', 
PRIORVALUE(OwnerId) <>'00G1r000003Bhko'), 

AND(ISCHANGED( OwnerId ), 
$UserRole.Name = 'Portal', 
PRIORVALUE(OwnerId) <>'00G1r000003Bhkm')), 

AND(ISCHANGED( OwnerId ), 
$UserRole.Name = 'Portal', 
PRIORVALUE(OwnerId) <>'00G1q000001DzGV')))
0

Try this:

AND(
   ISCHANGED(OwnerId), 
   $UserRole.Name = 'Portal', 
   NOT( Owner:User.Profile.Id = '<PortalProfileId>'), 
   OR(PRIORVALUE(OwnerId) != '<QueueID1>', 
       PRIORVALUE(OwnerId) != '<QueueID3>', 
       PRIORVALUE(OwnerId) != '<QueueID3>'
   )
)
3
  • Hi Pielax, the problem with your VR is the user is able to transfer lead to other users and vice-versa, It does work with regards to Queues. but I don't want them to be able to change ownership once they accept the lead from either of those 3 queues.
    – user30768
    Commented Mar 5, 2019 at 17:17
  • Ah, I see. Once they accept the Lead they are the owner, so I you won't be able to reference which queue it originally came from. You should be able to control this with the "Transfer Leads" permission. Without that permission they should still be able to accept leads, they just wouldn't be able to transfer them at all after that.
    – pielax
    Commented Mar 5, 2019 at 21:17
  • good point but unfortunately there are other users who use the same profile but different roles and they need permission to transfer leads, that is one of the reasons I was using '$UserRole.Name' rather then profile name. (and don't want to go through creating permission set as I would imagine it should be a straight forward validation rule).
    – user30768
    Commented Mar 6, 2019 at 10:41
0

You should be able to control this with the "Transfer Leads" permission at the profile level. Without that permission they should still be able to accept leads, they just wouldn't be able to transfer them at all after that.

If you'd rather use validation you can try something like this:

AND(
    Owner:User.Profile.Id = '<PortalProfileId>',
    ISCHANGED(OwnerId),
    OwnerId != $User.Id
)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .