Skip to main content
Ian Brown a posé une question dans #Data Management
I have Opportunity Stages 0-6 and whenever an Opportunity is created into Stages 1-6 OR changed to be in Stages 1-6, I want this Validation Rule to fire to require a custom Opportunity picklist field.  Below is what I have so far however when I try to add ISNEW to this, it doesn't work.  I've also tried creating a second validation rule exclusively for ISNEW and I can't seem to get that to work either.  Any suggestions from the community would be great!  HELP!

 

AND(Custom_Amount__c > 0, 

 

ISCHANGED( StageName ), 

 

OR( 

 

$RecordType.DeveloperName = 'REGION1', 

 

$RecordType.DeveloperName = 'REGION2', 

 

$RecordType.DeveloperName = 'REGION3', 

 

$RecordType.DeveloperName = 'REGION4', 

 

$RecordType.DeveloperName = 'REGION5', 

 

$RecordType.DeveloperName = 'REGION6', 

 

$RecordType.DeveloperName = 'REGION7'), 

 

ISBLANK(TEXT(Segment__c)), 

 

OR( 

 

CONTAINS(TEXT(StageName), '1'), 

 

CONTAINS(TEXT(StageName), '2'), 

 

CONTAINS(TEXT(StageName), '3'), 

 

CONTAINS(TEXT(StageName), '4'), 

 

CONTAINS(TEXT(StageName), '5'), 

 

CONTAINS(TEXT(StageName), '6') 

 

) 

 

)
2 réponses
  1. 19 nov. 2015, 20:00

    See if this works - 

    AND(

    Custom_Amount__c > 0,

    OR(

    ISCHANGED(StageName),

    ISNEW()

    ),

    OR(

    $RecordType.DeveloperName = 'REGION1',

    $RecordType.DeveloperName = 'REGION2',

    $RecordType.DeveloperName = 'REGION3',

    $RecordType.DeveloperName = 'REGION4',

    $RecordType.DeveloperName = 'REGION5',

    $RecordType.DeveloperName = 'REGION6',

    $RecordType.DeveloperName = 'REGION7'

    ),

    OR(

    CONTAINS(TEXT(StageName), '1'),

    CONTAINS(TEXT(StageName), '2'),

    CONTAINS(TEXT(StageName), '3'),

    CONTAINS(TEXT(StageName), '4'),

    CONTAINS(TEXT(StageName), '5'),

    CONTAINS(TEXT(StageName), '6')

    ),

    ISBLANK(TEXT(Segment__c))

    )

    Also, you could optimize this a little = 

    AND(

    Custom_Amount__c > 0,

    OR(

    ISCHANGED(StageName),

    ISNEW()

    ),

    CASE(

    RecordType.DeveloperName,

    'REGION1',1,

    'REGION2',1,

    'REGION3',1,

    'REGION4',1,

    'REGION5',1,

    'REGION6',1,

    'REGION7',1,

    0

    ) = 1,

    VALUE(LEFT(TEXT(StageName), 1)) >= 1,

    VALUE(LEFT(TEXT(StageName), 1)) <= 6,

    ISBLANK(TEXT(Segment__c))

    )

     

    Assuming that StageName are of the form = 1 - X, 2 - Y etc.