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
virat ms kohlivirat ms kohli 

Regarding date validation rule

Hi,

We have 2 objects named seller and invoice. Let's make a month into 2 parts as 1 to 15 and 16 to 31. The seller and invoice have a lookup relationship. If we entering data on the seller object from date 1 to 15 then the invoice date must only be before 1 to 15 that is before month 16 to 31. It should not enter future dates. Or else if we entering data on the seller object from date 16 to 31 then the invoice date must be before 16 to 31 which is the same month 1 to 15. That is a condition so kindly help me in developing validation rule for this. As I was new to salesforce kindly help by writing validation rule for me.

Thanks and Regards,
Virat
Nitin ShyamnaniNitin Shyamnani
Please write validation rule like this on Invoice object
IF(AND (Day(Seller__c.Date_Seller__c) <16,  Day( Date_Invoice__c ) >15), TRUE, IF(AND (Day(Seller__c.Date_Seller__c) >15,  Day( Date_Invoice__c ) <16), TRUE, FALSE))
 
If you want to check month and year also, you can add that condition in outer IF 
IF(YEAR(Date_Invoice__c)<> YEAR(Seller.Date_Seller__c),TRUE,IF(MONTH(Seller.Date_Seller__c)<> MONTH(Date_Invoice__c ),TRUE,IF(AND (Day(Seller.Date_Seller__c) <16, Day( Date_Invoice__c ) >15), TRUE, IF(AND (Day(Seller.Date_Seller__c) >15, Day( Date_Invoice__c ) <16), TRUE, FALSE))))
 
Replace "Seller" with your object Seller field api name on invoice object
and replace "Date_Seller__c" with Seller object's date field
and replace "Date_Invoice__c " with Invoice object's date field
jar paljar pal
Peryourhealth is basically an online health billing platform, where one can easily pay almost their entire medical bill online at https://peryourhealth.vip site. One can easily pay their utility bills, check their statement as well as request the fund transfer among many other facilities.