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
footprint_ninafootprint_nina 

Help on validation rule for picklist

I would like to create a validation rule that requires users to choose a priority (a picklist field i have created) for their opportunities but have this only apply to certain types of opportunities.
Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

Hi Nina, give this one a shot when you have a chance.  Let me know if it works for you.

 

AND ( OR( ( $RecordType.Name = "Project Development"), ( $RecordType.Name = "Partnership")), ISPICKVAL( Priority__c , ""))

 

 

 

All Answers

Steve :-/Steve :-/

Hi Nina, you can definitely do that, just wondering what you mean when you say "Certain types of Opportunities". 

Do you mean a specific value selected from the Opportunity.Type picklist field

or a specific Opportunity.RecordType

or some combination of fields and values on the Opportunity itself?

Message Edited by Stevemo on 11-05-2009 05:53 PM
footprint_ninafootprint_nina

Hi Steve,

I did mean a specific Opportunity Record Type. I want to make a validation rule that requires users to select a priority for only this type of record because the validation rule that i have in place (which just requires the priority to be selected for all opportunities) gets in the way of other opportunity record types, specifically when we edit old closed won opportunities.

 

thanks!

Steve :-/Steve :-/

No problem, can you post some specifics about the fields and record types?  (using the Code Clipboard icon in the Post Message Toolbar?  

 

I need to know your Opportunity record type names, your picklist names, picklist values, and a rough description of what you want for your triggers? 

 

for example:  If the Record Type = A then they have to pick 1, 2, or 3

 

or something like that

 

footprint_ninafootprint_nina

Thanks!

 

If Opportunity Record type equals Project Development (A) or  Partnership (B) this validation rule should apply and users must select a priority. users have several options for the priority and it doesnt matter which one they choose, just that they assign a priority.

 

If record type = A OR B, then they have to pick a Priority (Hot: Close within 3 months, Strategic, Pursuring only as time permits, dormant)

 

If Opportunity Record type equals Donation this rule should not apply.

 

Again, thanks for all your help!

Steve :-/Steve :-/

Are those the only 3 Opportunity Record Types that you have on your SFDC Org?

 

PS.  The Code Clipboard is the little Clipboard Icon with a "C" on it in the toolbar when you post a new message.  It makes posting formulas and code with commas and parens easier to read.

Message Edited by Stevemo on 11-05-2009 06:40 PM
footprint_ninafootprint_nina
We have a few other types, but they aren't used very often. We have lots of sub-types within each of these Opportunity types. Is there any other information you need?
Steve :-/Steve :-/
That should be enough for me to take a crack at it, although it's gonna have to wait until later (I'm an East Coaster)
Steve :-/Steve :-/

Hi Nina, give this one a shot when you have a chance.  Let me know if it works for you.

 

AND ( OR( ( $RecordType.Name = "Project Development"), ( $RecordType.Name = "Partnership")), ISPICKVAL( Priority__c , ""))

 

 

 

This was selected as the best answer
footprint_ninafootprint_nina
that works great! thank you so much!
Steve :-/Steve :-/
No problem, that's why they pay me the BIG Bucks! :smileywink: