I have two validation rules. I'm not able to use this validation at a time. I want to combine these two validation rules into one.

One rule Accept lead owner as user. When lead owner is set to queue that time I'm using this validation.


Another rule accept owner as queue.

NOT(BEGINS(PRIORVALUE( OwnerId ), "005")), NOT( ISNEW() ) 

Now how to simplify this rule as one. Any help much appreciated.

2 Answers 2


AND(LEFT( OwnerId , 3) = LEFT(PRIORVALUE( OwnerId ), 3), NOT( ISNEW() )

  • What is Left() in validation.? How it is work?
    – Jana Shree
    Commented Apr 5, 2016 at 4:33
  • In your validations you were comparing beginnings of Id string to "005" and "00G" - the first 3 characters of Id string in Salesforce are identifying to what Object it belongs - either standard or custom.
    – o-lexi
    Commented Apr 5, 2016 at 5:05
  • 005 is reserved for Users, 00G for Queues and so on... I'm using LEFT() formula which works like the same formula in Excel to extract the first 3 characters of current Id value of the owner and compare to the first 3 characters of prior Id value, except when the record was just created (PRIORVALUE() formula returns current value in this case and not NULL as you'd expect). The intention was this validation I believe was to restrict the current owner to assign an ownership to another user, and only allow it to be assigned to a queue, and vise versa
    – o-lexi
    Commented Apr 5, 2016 at 5:24

It would seem to me that you should be able to use a Logical OR to check either of the PRIORVALUES. It would look something like this:

AND( NOT(BEGINS(PRIORVALUE( OwnerId )), "00G" OR "005"), NOT( ISNEW() ) )


First, I definitely had a parens out of position after OwnerId above. I've edited that to correct it.

If that doesn't do it, it could be we may be placing the OR in the wrong location. It could be that the PriorValue of OwnerID not beginning with "xxx" needs to be expressed all at once before you can do the OR in this type of format. If that were the case, the following should work.


You could also simply reconstruct it as something like:

  • 1
    Probably more consistent to use OR instead since you already use AND.
    – Adrian Larson
    Commented Apr 4, 2016 at 13:30
  • It shows error "Incorrect parameter type for function 'or()'. Expected Boolean, received Text"
    – Jana Shree
    Commented Apr 4, 2016 at 13:31
  • I wasn't certain if it would need an OR or the ||. Docs seemed to indicate the latter, so may want to substitute OR instead. Will edit to show.
    – crmprogdev
    Commented Apr 4, 2016 at 13:41
  • It's Not Working.. Any other way to declare this..
    – Jana Shree
    Commented Apr 4, 2016 at 16:47
  • See edited answer. Between the edit to the original and the two alternatives, one of those should do it.
    – crmprogdev
    Commented Apr 4, 2016 at 18:32

You must log in to answer this question.

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