function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
HareHare 

validation rule help

validation rule  : Either Opportunity Name field or Case Number field must be populated, but not both. plz help me on this
Best Answer chosen by Hare
Amit Chaudhary 8Amit Chaudhary 8
Please try below code. Please modify field name according to your org.

 
OR
(
    AND
    (
        NOT( ISBLANK(Opportunity__c) ),
        NOT( ISBLANK(Case__c))
    ),
    AND(
        ISBLANK(Opportunity__c) ,
        ISBLANK( Case__c )
    )
)

Please make this as solution if this will help you.
 

All Answers

Amit Chaudhary 8Amit Chaudhary 8
Please try below code. Please modify field name according to your org.

 
OR
(
    AND
    (
        NOT( ISBLANK(Opportunity__c) ),
        NOT( ISBLANK(Case__c))
    ),
    AND(
        ISBLANK(Opportunity__c) ,
        ISBLANK( Case__c )
    )
)

Please make this as solution if this will help you.
 
This was selected as the best answer
surasura
could you give the following information

1. In what objects these fields are in, because Opportunity Name field on opportunity object is required and we cant change that
2. Are both these fields in the same object?