You need to sign in to do that
Don't have an account?
Preet Kaur
Picklist / Checkbox Validation Rule
Hi, I'm new to salesforce and would appreciate any help! I've not done very many validation rules either.
If the 'Break Penalty inc. VAT' checkbox is checked and the 'Break Penalty Paid' picklist value is "Yes" an amount must be entered in the 'Break Penalty' field. Allowing the record to save. The formula should also work when the checkbox is checked and an amount is entered in the 'Break Penalty' field, the rule should fire telling the user to state whether the penalty has been paid in the 'Break Penalty Paid' picklist field. ('Yes' or 'No')
The current formula I have is:
AND( ISPICKVAL( Break_Penalty_Paid__c , 'Yes') || Break_Penalty_inc_VAT__c = TRUE && ISBLANK( Break_Penalty__c ) )
I am trying to save the record but I'm getting an error message..below..
Any Help is Appreciated!! Thanks
If the 'Break Penalty inc. VAT' checkbox is checked and the 'Break Penalty Paid' picklist value is "Yes" an amount must be entered in the 'Break Penalty' field. Allowing the record to save. The formula should also work when the checkbox is checked and an amount is entered in the 'Break Penalty' field, the rule should fire telling the user to state whether the penalty has been paid in the 'Break Penalty Paid' picklist field. ('Yes' or 'No')
The current formula I have is:
AND( ISPICKVAL( Break_Penalty_Paid__c , 'Yes') || Break_Penalty_inc_VAT__c = TRUE && ISBLANK( Break_Penalty__c ) )
I am trying to save the record but I'm getting an error message..below..
Any Help is Appreciated!! Thanks
Can you try the below. So I basically combined both the validations you were asking about, but if you want 2 seperate validation rules, you can take the OR part and split out into two.
IF(OR(AND(ISPICKVAL( Break_Penalty_Paid__c , 'Yes'), Break_Penalty_Inc_VAT__c, ISNULL( Break_Penalty__c )),(AND ( NOT(ISNULL(Break_Penalty__c)),Break_Penalty_Inc_VAT__c,TEXT(Break_Penalty_Paid__c)!= "YES"))),true,false)
If you want two validations
Validation 1 :
IF(AND(ISPICKVAL( Break_Penalty_Paid__c , 'Yes'), Break_Penalty_inc_VAT__c, ISNULL( Break_Penalty__c )),true,false)
Validation 2 :
IF((AND ( NOT(ISNULL(Break_Penalty__c)),Break_Penalty_inc_VAT__c,TEXT(Break_Penalty_Paid__c)!= "YES")),true,false)
Hope this helps
Thank you for your response on this. I have tried it as one validation rule and it allows the record to be saved however, when tresting in other scenarios, I get an error message below:
Also, when ONLY checking the checkbox, the formula allows the record to save. Which I was hoping for it not to do that. As an amount must be entered in 'Break Penalty' if the checkbox is true.
I am also able to save the record without entering an amount in 'Break Penalty' if the picklist field value is 'yes'.
Just wondering if it can actually be done in one validationr ule or does it have to be 2?
IF(OR(AND(ISPICKVAL( Break_Penalty_Paid__c , 'Yes'), Break_Penalty_Inc_VAT__c, ISNULL( Break_Penalty__c )),(AND ( NOT(ISNULL(Break_Penalty__c)),Break_Penalty_Inc_VAT__c,TEXT(Break_Penalty_Paid__c)!= "YES"))),true,false)
The validation is
1. if checkbox is checked and picklist is "yes", you have to have an amount
2. If checkbox is checked and amount entered, the picklist must be yes.
Let me know if this is what you are looking for.
Since there are 2 conditions, if you want to have same error message for both conditions, you can write only one rule.
1. if checkbox is checked and picklist is "yes", you have to have an amount
2. If checkbox is checked, you must enter an amount.
3. If checkbox is checked, picklist is "yes" and amount is i.e. 1000 and save. But then change my mind to picklist "no" it should allow the record to save.
Is that possible?
You must first have picklist set to "Yes" (cannot have anything else saved). and then have checkbox and amounts entered, and then if you want you can make the picklist to NO.
This works on PRIORVAL which I am checking "yes". If its more than what you are looking for. then you might need to write a trigger.
IF(OR(AND(ISPICKVAL( Break_Penalty_Paid__c , 'Yes'), Break_Penalty_Inc_VAT__c, ISNULL( Break_Penalty__c )),(AND ( NOT(ISNULL(Break_Penalty__c)),Break_Penalty_Inc_VAT__c,NOT(ISPICKVAL(PRIORVALUE(Break_Penalty_Paid__c), "Yes"))))),true,false)
1. if checkbox is checked and picklist is "yes", you have to have an amount
2. If checkbox is checked, you must enter an amount.
What will be the formula for this?
IF(AND(Break_Penalty_Inc_VAT__c, ISNULL( Break_Penalty__c )),true,false)