+ Start a Discussion
kris chitkris chit 

Validation Rule Fire on populating other fields

Hi,

I am trying to create a validation rule where  "Frequency" picklist field should be made required when user enters any value in "Min Rate" and "Max Rate" currency fields.  Could someone  please guide me.

 
VamsiVamsi
Hi,

Please try the below.

AND(ISBLANK(Frequency),OR(NOT(ISBLANK(Min Min )),NOT(ISBLANK(Max Rate ))))

Also please make sure to provide correct api names for Frequency,"Min Rate" and "Max Rate"  fields.

Please mark as best answer if the above helps..!!!
kris chitkris chit
Below is my validation rule. It fires correctly and shows "Req_Rate_Frequency__c" is required when user enters any value in "Bill Rate Min" and "Bill Rate Max". But it is firing and showing the message even if both the fields are not populated also.

AND(ISPICKVAL(Req_Rate_Frequency__c,''),(OR(ISBLANK(Req_Bill_Rate_Max__c),Req_Bill_Rate_Max__c>0))))
VamsiVamsi
Yes, Because you have written in such a way to trigger the validation rule.

Please try the below validation rule 

AND(ISBLANK(Req_Rate_Frequency__c),OR(NOT(ISBLANK(Req_Bill_Rate_Max__c)),NOT(ISBLANK(Req_Bill_Rate_Min__c ))))

Above validation triggers only when there is a vaue in either max rate or min rate 
kris chitkris chit
It is throwing an error saying picklist values should use "ISPICKVAL".
Harsh Aditya 21Harsh Aditya 21
Hi Kris,

Try the below formula, it will work :-
 
AND(ISPICKVAL(Req_Rate_Frequency__c,''),OR(NOT(ISBLANK(Req_Bill_Rate_Max__c )),NOT(ISBLANK(Req_Bill_Rate_Max__c ))))

Just to make you understand, to fire a validation rule 
Condiontion 1 - Req_Rate_Frequency__c must be Blank
Condition 2 - Either both fields  'Req_Bill_Rate_Max__c'  and 'Req_Bill_Rate_Max__c' should have some value or atleast one field should have some value, (or in other words atleast one field should not be blank).

In your formula, problem is with the second part of the formula
(OR(ISBLANK(Req_Bill_Rate_Max__c),Req_Bill_Rate_Max__c>0))

Her, if both the fields are blank then validation will fire (ISBLANK(Req_Bill_Rate_Max__c) holds true ) ,
 if both the fields have value then also the validation will fire (Req_Bill_Rate_Max__c>0 will hold true)


Harsh.
kris chitkris chit
Below is my validation rule conditions:
1. Should not fire for "System Integration" profile
2. Should fire for Opportunity Stages =Draft or qualified or presenting or closed won
3. should fire when record type = proactive or req
4. should fire only when product=contract or contract to hire
5. Should fire when "Bill Rate Min" and "Bill Rate Max" values are filled and "Req_Rate_Frequency__c"(picklist) is not selected.

Below is the rule:

AND(
$Profile.Name != 'System Integration',

OR(TEXT(StageName) = 'Draft',TEXT(StageName) = 'Qualified',TEXT(StageName) = 'Presenting',TEXT(StageName) = 'Closed Won'),

OR($RecordType.DeveloperName = 'Proactive', $RecordType.DeveloperName = 'Req'),

OR(TEXT(Req_Product__c)='Contract',TEXT(Req_Product__c)='Contract to Hire'),

AND(ISPICKVAL(Req_Rate_Frequency__c,''),(OR(NOT(ISBLANK(Req_Bill_Rate_Max__c)),NOT(ISBLANK(Req_Bill_Rate_Max__c))))))
VamsiVamsi
Hi,

Is this still throwing an error.
kris chitkris chit
Hi,

I was able to resolve it. Below is the rule.

AND( 
$Profile.Name != 'System Integration', 
OR 

TEXT(StageName) = 'Draft', 
TEXT(StageName) = 'Qualified', 
TEXT(StageName) = 'Presenting', 
TEXT(StageName) = 'Closed Won' 
), 
OR 

$RecordType.DeveloperName = 'Proactive', 
$RecordType.DeveloperName = 'Req' 
), 
OR 

TEXT(Req_Product__c)='Contract', 
TEXT(Req_Product__c)='Contract to Hire'), 
AND 

ISPICKVAL(Req_Rate_Frequency__c,''), 
OR 

OR 

NOT(ISBLANK(Req_Bill_Rate_Max__c)), 
Req_Bill_Rate_Max__c>0 
), 
OR 

NOT(ISBLANK(Req_Bill_Rate_Min__c)), 
Req_Bill_Rate_Min__c>0 



)