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
Sam WardSam Ward 

Validation on Blank pick list

Hey, So I've been all over the forums and cannot seem to find the solution for this or where I am going. If anyone could shed any light on this it would be much appreciated.

What am trying to achieve: Validation of Picklist which cannot be (Blank) Here is what I've got so far:

AND ( 
$Label.Validation_Switch = "ON", 
Cancelled__c = True, 
(Case_ID__r.UK_Canada__c)= "UK", 
ISBLANK(Reason_for_Cancellation__c), 
TEXT(Reason_for_Job_Cancellations__c) <> "None", 
TEXT(Drill_Down_on_cancelled_reason__c) <> "None")​

Okay so the top couple of lines run and work absolutly fine but then when I place those 2 extra requirements in it accepts the code but validate anything. 

I've tried a few different things this is the last thing I tried and where I am currently stuck!

Any help would be massive on this.
Thanks 

Best Answer chosen by Sam Ward
veda Hebbarveda Hebbar
AND ( 
$Label.Validation_Switch = "ON", 
Cancelled__c = True, 
(Case_ID__r.UK_Canada__c)= "UK", 
OR(ISBLANK(Reason_for_Cancellation__c),ISBLANK( TEXT(Reason_for_Job_Cancellations__c))) 
)

please check this.

All Answers

Terence_ChiuTerence_Chiu
Have you tried ISPICKVAL(Reason_for_Job_Cancellations__c, "") ?
Sam WardSam Ward
Hi Terence,

Thanks for your reply I have tried this no luck sorry, I will keep trying until I get it working it will be something small and stupid from my side! :)
veda Hebbarveda Hebbar
Hi,
ISBLANK( TEXT(Reason_for_Job_Cancellations__c) )


Please try this
 
veda Hebbarveda Hebbar
Hi Sam Ward,

Are you able to solve the issue? Please let me know if you need more information or help on this.

Thanks,
Vedashri

 
Sam WardSam Ward
Hi Vedashri,

I've tried it and unfortunatly its not working with that, any other ideas? 


Thanks
 
veda Hebbarveda Hebbar
Hey Sam,


your are not getting validation error if 'Reason_for_Job_Cancellations__c' blank?

 
Sam WardSam Ward
nope nothing it accepts the fornula but never returns the validation error.
Sam WardSam Ward
I've got the same question on salesforce success community and have tried the following but no luck either I just cant under why. 

Attempt 1
AND( $Label.Validation_Switch = "ON",
Cancelled__c = TRUE,
Case_ID__r.UK_Canada__c = "UK",
ISBLANK(Reason_for_Cancellation__c),
ISBLANK(TEXT(Reason_for_Job_Cancellations__c)),
ISBLANK(TEXT(Drill_Down_on_cancelled_reason__c)) )​

Attempt 2
AND( $Label.Validation_Switch = "ON",
Cancelled__c = TRUE,
Case_ID__r.UK_Canada__c = "UK",
ISBLANK(Reason_for_Cancellation__c),
OR(
ISBLANK(TEXT(Reason_for_Job_Cancellations__c)),
ISBLANK(TEXT(Drill_Down_on_cancelled_reason__c)) ) )​

I need all those fields to be required if Cancelled = True (UK/Canada, Reason for cancellation, Reason for Job Cancellation & Drill Down Reason)

I've looked all over the net and cant figure out why, I have tried one line at a time and on there own it makes the field required using your below method:

Attempt 3

ISBLANK( TEXT(Reason_for_Job_Cancellations__c) )

but put into the entire script it just doesn't ask for any validation.

If any of that helps? 
veda Hebbarveda Hebbar
Can you please just try to add only below validation rule in formula and check
ISBLANK( TEXT(Reason_for_Job_Cancellations__c) )

this is giving validation error for me if the Reason_for_Job_Cancellations__c field value is blank
veda Hebbarveda Hebbar
Can you please share your formula in validation rule here?
Sam WardSam Ward
AND ( 
$Label.Validation_Switch = "ON", 
Cancelled__c = True, 
(Case_ID__r.UK_Canada__c)= "UK", 
ISBLANK(Reason_for_Cancellation__c), 
ISBLANK( TEXT(Reason_for_Job_Cancellations__c)))
veda Hebbarveda Hebbar
AND ( 
$Label.Validation_Switch = "ON", 
Cancelled__c = True, 
(Case_ID__r.UK_Canada__c)= "UK", 
OR(ISBLANK(Reason_for_Cancellation__c),ISBLANK( TEXT(Reason_for_Job_Cancellations__c))) 
)

please check this.
This was selected as the best answer
veda Hebbarveda Hebbar
Also, can you please check and confirm below formula is giving validation error or no if 'Reason_for_Job_Cancellations__c' field is blank
ISBLANK( TEXT(Reason_for_Job_Cancellations__c) )

 
Sam WardSam Ward
Hi Veda!

You sir are a GENIUS! The help is and was much appreciated!
Veda Hebbar = Legend!

Forumla code: 

AND ( 
$Label.Validation_Switch = "ON", 
Cancelled__c = True, 
(Case_ID__r.UK_Canada__c)= "UK", 
OR(ISBLANK(Reason_for_Cancellation__c), 
ISBLANK( TEXT(Reason_for_Job_Cancellations__c)), 
ISBLANK( TEXT(Drill_Down_on_cancelled_reason__c)) 
))

Thank you!