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
DODO 

Validation Rules

Hi,

 

I have two inquiries on creating validation rules for opportunities:

 

1.) I have 4 Multiple picklist fields that I want to make mandatory so that at least 1 must be filled in (the other 3 can be defaulted to "None").

2.) I have 2 opps - one is related to the other - and I want to create a validation rule on the second opportunity so that the close date can never be before the first one.

 

Please let me know if this can be done,

 

Thanks so much!

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

1) By "none", I presume you mean, have no selected values. Change the field names, as appropriate.

 

 

AND( ISBLANK( Field1__c ), ISBLANK( Field2__c ), ISBLANK( Field3__c ), ISBLANK( Field4__c ) )

2) Same as above; change the field name.

 

 

 

AND( NOT( ISBLANK( OtherOpp__c ) ), CloseDate < OtherOpp__r.CloseDate )

These should be okay. I've been doing more coding, and less customization, but these should be okay. If not, change ISBLANK to ISNULL.

 

All Answers

sfdcfoxsfdcfox

1) By "none", I presume you mean, have no selected values. Change the field names, as appropriate.

 

 

AND( ISBLANK( Field1__c ), ISBLANK( Field2__c ), ISBLANK( Field3__c ), ISBLANK( Field4__c ) )

2) Same as above; change the field name.

 

 

 

AND( NOT( ISBLANK( OtherOpp__c ) ), CloseDate < OtherOpp__r.CloseDate )

These should be okay. I've been doing more coding, and less customization, but these should be okay. If not, change ISBLANK to ISNULL.

 

This was selected as the best answer
DODO

These works, thank you very much! :)