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
Naveen KvpNaveen Kvp 

Validation for fields mandatory

Hi Friends

Validation:In Tax Master i have a Three fields Excise duty,Vat And Cst if we fill Excise duty either Vat or Cst only one should enter.

How to write a validation for this please provoide some inputs,Thanks in advance.

i am writing a Validation like this but it won't work:
 
AND( 
ISBLANK( Excise_Duty__c ), 
OR( 
NOT(ISBLANK(VAT__c)), 
ISBLANK(CST__c) 
), 
OR( 
NOT(ISBLANK(CST__c)), 
ISBLANK(VAT__c) 
) 
)
Amit Chaudhary 8Amit Chaudhary 8
Please try below validation rule :-
AND(
      NOT( ISBLANK( Excise_Duty__c ) ),
      AND ( NOT ( ISBLANK( VAT__c )),
                  NOT ( ISBLANK( CST__c ))
           )
)

Please let us know if this will help you
 
ManojjenaManojjena
Hi Naveen,

Try with below formula it will help !!

This formula will work when user will enter Exciseduty he/she needs to enter  either VAT or CST .
 
AND(NOT(ISBLANK( Excise_Duty__c )),ISBLANK(VAT__c),ISBLANK(CST__c))
I think you need reverse formula as well ,if requried you can use below code .It will allow usr to add VAT/CST only when he/she eneter Ecise duty .
 
AND(ISBLANK( Excise_Duty__c ),OR(NOT(ISBLANK(VAT__c)),NOT(ISBLANK(CST__c))))
Not sure you need the second on eor not ,if required then use .

Let me know if it helps .


Thanks
Manoj

 
ManojjenaManojjena
Hi Naveen ,

I think it will good if you will write Two validation to achieve the above .

One is to check that when ever you will eneter the ExciseDuty VAT and CST is mandatory ,but in this case you can enter both VAT and CST .
 
AND(NOT(ISBLANK( Excise_Duty__c )),ISBLANK(VAT__c),ISBLANK(CST__c))
To restrict user to eneter any only one ,you can write below formula .
 
AND(NOT(ISBLANK(VAT__c)),NOT(ISBLANK(CST__c)))

So both will help  you to achive your goal .

Let me know any issue .