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
StardustStardust 

Some help with a Validation Rule

I have tried this in many versions, but it just does not work as it should.
I hope somebody can help me!

This is the background:
SAP_Account_Id__c and Navison_Account_Id__c are two text fields
Sell_to__c and Ship_to__c are two checkboxes.
The rule should ensure that a record which has either SAP_Account_Id__c or Navison_Account_Id__c filled in (or both), can be saved only if either Sell_to__c and Ship_to__c (or both) are checked. 

This is the last version of the Formula that should evaluate to True:

IF(

ISBLANK(SAP_Account_Id__c)&& ISBLANK( Navison_Account_Id__c),False,
(
IF (
NOT(ISBLANK(Navison_Account_Id__c))|| NOT(ISBLANK(SAP_Account_Id__c)) &&

((Sell_to__c =FALSE && Ship_to__c=TRUE) ||
(Sell_to__c =TRUE && Ship_to__c=FALSE) ||
(Sell_to__c =TRUE && Ship_to__c=TRUE)), False,
(
IF (
NOT(ISBLANK(Navison_Account_Id__c))&& NOT(ISBLANK(SAP_Account_Id__c)) &&

((Sell_to__c =FALSE && Ship_to__c=TRUE) ||
(Sell_to__c =TRUE && Ship_to__c=FALSE) ||
(Sell_to__c =TRUE && Ship_to__c=TRUE)), False,
True

)))))

Thank you very much in advance!
Kind regards
Best Answer chosen by Stardust
StardustStardust
Hi there,

and first of all: Thank you for your help, both @anilbathula@ and yogesh_cp8888.

Your input has been precious. Both formulas worked almost fine...but not as I needed to, so they served me as a starting point to develop the following:

IF((AND(Sell_to__c=false ,Ship_to__c=false)),

(AND(Sell_to__c=false ,Ship_to__c=false) || AND(ISBLANK(SAP_Account_Id__c),ISBLANK( Navison_Account_Id__c))),

False
)

Thanks again!
Ana

All Answers

@anilbathula@@anilbathula@
Hi stardust

try this validation rule:-

AND(Sell_to__c=false ,Ship_to__c=false) || AND(ISBLANK(SAP_Account_Id__c),ISBLANK( Navison_Account_Id__c))



Thanks
Anil.B.
Chandra PrakashChandra Prakash
Hi Stardust ,

Please try this validation rule :


OR( ISBLANK( SAP_Account_Id__c ) , ISBLANK( Navison_Account_Id__c ) ,IF( Sell_to__c  = false,  true  ,false) ,IF(  ship_to__c   = false,  true  ,false) )


Thanks
Chandra Prakash Sharma
Bisp Solutions Inc.
StardustStardust
Hi there,

and first of all: Thank you for your help, both @anilbathula@ and yogesh_cp8888.

Your input has been precious. Both formulas worked almost fine...but not as I needed to, so they served me as a starting point to develop the following:

IF((AND(Sell_to__c=false ,Ship_to__c=false)),

(AND(Sell_to__c=false ,Ship_to__c=false) || AND(ISBLANK(SAP_Account_Id__c),ISBLANK( Navison_Account_Id__c))),

False
)

Thanks again!
Ana
This was selected as the best answer