+ Start a Discussion
inertiainertia 

Custom Validation Rule Not Working

AND(ISPICKVAL(StageName, "Quotation | Drawing Submittal"),EVO_Quote_No__c = " ")

 

My formula is not working. I am trying to a Quote Number ( the Field Type: Text) if I reach a specific Stage in the Sales Process. What am I doing wrong? 

werewolfwerewolf

Is your stage really called "Quotation | Drawing Submittal"?  Or are you trying to do an ISPICKVAL on Quotation _or_ Drawing Submittal?  If that's the case then you'll want

 

 AND(
    OR(
        ISPICKVAL(StageName, "Quotation"),
        ISPICKVAL(StageName, "Drawing Submittal")
    ),
    EVO_Quote_No__c = " "
)

inertiainertia
Yes. That is the Exact manner in which my Stage reads. Could it have something to do with the type of Field that I am creating the formula on (i.e., text, date, currency, etc.)?
ExecbizExecbiz

A couple options - maybe you'll have to use

 

TEXT(EVO_Quote_No__c = "")

 

to get it to acknowledge that the value is text.

 

But what I would try first is:

 

AND (StageName = "Quotation | Drawing Submittal", ISNULL(EVO_Quote_No__c)) 

snugglessnuggles
Your formula is working for me when i try recreating it.  What exactly is the problem?  It's giving you false positives or it's not adding an error when it should? I would check other things that are interacting with the fields you are using because your formula looks syntactically sound.  Maybe there is a workflow/trigger that is updating the field after the save?  Giving it the illusion that the validation is broken when in reality it's an order of execution issue?
inertiainertia
Thank you for oyur thoughts. It is not adding the error when it should. I do not have any workflow triggers running.
inertiainertia

It looks like this the Field Type is my problem

"Text fields are never null, so using this function with a text field always returns false. For example, the formula field IF(ISNULL(new__c) 1, 0) is always zero regardless of the value in the New field."

Any suggestions for a workaround. If I change my Field Type to Number, I will lose all my historical data. That is not an option.

ExecbizExecbiz

Did you try:

 

IF(TEXT(EVO_Quote_No__c = ""))

inertiainertia

AND(ISPICKVAL (StageName, "Waiting on Response"), IF(TEXT(EVO_Quote_No__c = ""))

Returns: ERROR: Syntax error. Missing')'

ExecbizExecbiz
Thats an error in quotes and punctuation, not logic...check to make sure that all start quotes have end quotes, and look in the AND function and ISPICKVAL function definitions to see if you are mising an argument to the function
CRM indiaCRM india

Try this

 

AND ( ISPICKVAL(StageName, "Quotation | Drawing Submittal"), LEN(EVO_Quote_No__c)=0)

 

Thanks

inertiainertia

CRM india - Thank you. That formula worked.