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
BneighborsBneighbors 

How to create a Validation rule of both fields can be blank but both can not be filed in.

I'm trying to set up a Validation rule to show an error if both of the below fields are filled in but not if both are blank. 

or( 
and(!isblank( Strategic_Partner__c ),!ISBLANK( Reseller__c )), 
or(!ISBLANK( Reseller__c) ,!isblank( Strategic_Partner__c )) 
)
Best Answer chosen by Bneighbors
Jega DeivaJega Deiva
Hi

       Try this

               AND(  Strategic_Partner__c   <> Null , Reseller__c <> Null)


Thanks
Jega
Sweet potatotec
 

All Answers

Raj VakatiRaj Vakati
Try this
 
AND(
AND(ISBLANK( Strategic_Partner__c ),ISBLANK( Reseller__c )) , 
AND(NOT(ISBLANK( Strategic_Partner__c )),NOT(ISBLANK( Reseller__c ))) 
)

 
BneighborsBneighbors
@raj Vakati It let me put in values for both fields.  
Dave BerenatoDave Berenato
Hi Bneighbors

If you ONLY want it to error when both are filled in:
AND( 
NOT(ISBLANK( Strategic_Partner__c )), 
NOT(ISBLANK( Reseller__c )) 
)

If you want it to error when 1 or both are filled in:
 
OR( 

AND( 
NOT(ISBLANK( Strategic_Partner__c )), 
ISBLANK( Reseller__c ) 
), 

AND( 
ISBLANK( Strategic_Partner__c ), 
NOT(ISBLANK( Reseller__c )) 
), 

AND( 
NOT(ISBLANK( Strategic_Partner__c )), 
NOT(ISBLANK( Reseller__c  )) 
) 
)



 
Jega DeivaJega Deiva
Hi

       Try this

               AND(  Strategic_Partner__c   <> Null , Reseller__c <> Null)


Thanks
Jega
Sweet potatotec
 
This was selected as the best answer
Raj VakatiRaj Vakati
try this
 
OR(
    AND(ISBLANK(Strategic_Partner__c), NOT(ISBLANK(Reseller__c))),
    AND(NOT(ISBLANK(Strategic_Partner__c)), ISBLANK(Reseller__c))
)

 
Jega DeivaJega Deiva
@raj vakati
     
       It's not  work  for  me.
       It  stores  the  value  if  two  fields  are  filled.

Thanks
Jega
BneighborsBneighbors

Hi @dave Those should have worked but did not.  @Jega that worked and was very clean.  Thank you.  @Raj I had the result that Raj did.  
 

Thanks, everyone.