1

I have the following validation to prevent the opp record to be saved without a type

Rule:

AND( 
$User.Id = Owner.Id, 
CONTAINS( $UserRole.Name, "Sales"), 
RecordTypeId = "014G00000011acd", 
OR( 
   ISPICKVAL( StageName,"New"), 
   ISPICKVAL( StageName,"Invented"), 
   ISPICKVAL( StageName,"Solved"), 
   ISPICKVAL( StageName,"Negative"), 
   ISPICKVAL( StageName,"Closed-Won"), 
   ISPICKVAL( StageName,"Closed-Lost"), 
   ), 
ISPICKVAL( Type, "" ) )

I have no syntax errors but the validation is not firing when I create the record as sales rep.

1
  • +1 for indenting your VR code; note that comma after the closed-lost ISPICKVAL shouldn't be there as per @JennyB
    – cropredy
    Nov 3, 2015 at 0:16

1 Answer 1

1

I believe the issue is with referencing the relationship field Owner.Id instead of OwnerId since the relationship fields will not be available until after the record is committed. Also noticing an extra comma and blank line in your OR function.

2
  • The rule is working fine if I do for a single stagename the issue comes when I have this multiple stagenames with the OR condition. The rule should work for any of these stages. Nov 2, 2015 at 21:19
  • @SalesforceLearner Did you get rid of the extra comma and new line in your OR clause?
    – Jenny B
    Nov 2, 2015 at 21:20

You must log in to answer this question.

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