Skip to main content

Hi fellow Trailblazers,    I'm attempting to create a validation rule that will fire if   1) the opportunity record type is not one particular type,  2) the amount field on an opportunity is null or 0,  and  3) the stage is one of four values    I inputted this text:  "AND( RecordType.Id<>"0120b000000udB0AAI",  OR( Amount =0,ISNULL(Amount)=TRUE),  OR( ISPICKVAL(StageName,"Pledged"),  ISPICKVAL(StageName,"Received"),  ISPICKVAL(StageName,"Awarded - Open"),  ISPICKVAL(StageName,"Awarded - Closed"))  )"    The validation rule is firing on opportunities that ARE the record type I specified in the first condition. Does anyone know why this is happening? Please help!   

4 answers
  1. May 14, 7:38 PM

    a few things:  

     

    First: Validation Rule Formulas can't read the full 18 character ID, they can only the 15 character ID  

     

    Second:  Don't use hard coded ID in Formulas, use RecordType Name or DeveloperName   

     

    Third:  Don't use ISNULL, that Function has been deprecated by Salesforce like 10+ years ago   

     

    I would write it like this

    AND(

    RecordType.Name <> 'Hi My Name Is',

    OR(

    Amount = 0,

    ISBLANK(Amount)

    ),

    CASE( StageName,

    'Pledged', 1,

    'Received', 1,

    'Awarded - Open', 1,

    'Awarded - Closed', 1,

    0 ) = 1

    )

0/9000