You need to sign in to do that
Don't have an account?
Picklist validation rule
Hello All,
I'm hoping someone could help me here...
I'm trying to write a validation rule that flags a custom picklist field (Primary Win Reason) to be populated once the stage reaches a Win level (we have a "unusual" naming convention, and have 2 types of wins - outlined below). Here's what I wrote:
AND (
OR (
ISPICKVAL(StageName, "7.0 Transition - Win"),
ISPICKVAL(StageName, "7.0 Transition - Win with Exception")),
ISBLANK( PrimaryWinReason__c )
Problem is, I get the following error:
Error: Field PrimaryWinReason__c is a picklist field. Picklist fields are only supported in certain functions. Tell me more
Help please?!?
Okay, if your other field is also a Picklist you can't use the ISBLANK function unless you convert it to a Text String. Try something like this instead.
All Answers
If you want the Opportunity.PrimaryWinReason__c field to be required any time an Opportunity is won, regardless of the Stage picklist value selected you can ignore the Opportunity.StageName field altogether and just evaluate the Opportunity.IsWon Boolean field in your formula.
Thanks so much for the help! I tried the formula you suggested, and it still gave me the picklist error - any suggestions? Does it matter that the Primary Win Reason is a picklist? I would think that it is just verifing that it is blank...
Thanks again for your help!
Field PrimaryWinReason__c is a picklist field. Picklist fields are only supported in certain functions. Tell me more
Okay, if your other field is also a Picklist you can't use the ISBLANK function unless you convert it to a Text String. Try something like this instead.
- Picklist fields can only be used in the following functions:
* ISPICKVAL—Compares the value of a picklist to a single value.
* CASE—Compares the value of a picklist to multiple values.
* TEXT—Converts a picklist value into a text value so that you can work with the value in functions that support text value, such as CONTAINS. (Only available in formula fields, validation rules, and workflow field updates.)
AND (
OR (
ISPICKVAL(StageName, "7.0 Transition - Win"),
ISPICKVAL(StageName, "7.0 Transition - Win with Exception")),
TEXT(PrimaryWinReason__c) <> "unusual")
It will show an error message if StageName = "7.0 Transition - Win" OR "7.0 Transition - Win with Exception"
and PrimaryWinReason__c != unusual.
Worked like a charm...thank you!
To do the same with a Loss, would I just have to change "IsWon" to "Is Loss"?
No there isn't an IsLost boolean field, you have to evaluate IsClosed = TRUE and IsWon = FALSE like this.
Thanks Stevemo...the code was accepted, but it doesn't flag the field if left blank when saving the opportunity. I think I may have some more tweaking to do. Any ideas of why it isn't working would be great.
Thanks so much for your help on this - you are a lifesaver!
That VR Formula came directly from my SFDC.org, we use it all the time and it works fine.
What is the API Field Name and datatype of your Loss Reason field on your Opportunity object? Can you post the VR Formula that you're using?
Sure - I think this is what you are asking for:
And here is the formula I'm using (again, the syntax checks out, but when I apply it, it's not working like the Primary Win Reason one did.
AND (IsClosed,
NOT(IsWon),
ISPICKVAL( PrimaryLossReason__c ,""))
What is the Opportunity Stage that you are selecting that should cause the error is Loss Reason is left blank? And can you verify in the Opportunity Stage configuration that the Stage you're selecting does equal Closed = TRUE and WON = FALSE?
Again, we have a strange naming convention...here's the 3 stages of Loss:
They are all Closed/Lost as a type, as opposed to the Closed/Won for our wins.
Is that what you are referring to regarding the Opportunity Stage Config?