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
Aleli LopezAleli Lopez 

how to make checkbox required if picklist value is correct

Hi all,
I have this requirement to make checkbox "Required" if the selected picklist value is correct. Let say if my picklist value is "IT", my checkboxes of Java, Javascript should displayed as required.
Best Answer chosen by Aleli Lopez
AnkaiahAnkaiah (Salesforce Developers) 
Hi  Aleli Lopez,

try with below validation rule.
AND(ISPICKVAL(PicklistField__c,'IT'), OR(Java__c=false,Javascript__c =false))
If this helps,please mark it as best answer

All Answers

Md ThameemMd Thameem
Hi  Aleli Lopez,

We can achive your requiement with Validation reules.

Formula sample,

IF( AND (ISPICKVAL(YourPickList_Field__c , 'IT') , OR( NOT(Java__c), NOT(Javascript__c ) ) )  , else statement with other picklist values  ).

 
Jayeshkumar ParmarJayeshkumar Parmar

Hi Aleli Lopez,

By making a check-box required,do you mean that the check-box has to be checked ,when the picklist value to 'IT'
 
In that case you can try this,

On an Object you have Checkbox  'java__c' and  a Picklist field 'picklistField__c' ,
Under the Checkbox , fields and Relationship Section Click the 'Field Dependencies' button, Click New
In the controlling Field choose java__c and in Dependent field Choose picklistField__c
 
The page that opens next is very self explanatory so you can follow the instructions and you'll learn that Checkbox can be used in a dependent picklist

OR

You can try the below formula on the checkbox field

If( text(PicklistField__c) =='IT' ,True ,true)

Please Mark It As Best Answer If It Helps.

Thanks,
Jayeshkumar Parmar

AnkaiahAnkaiah (Salesforce Developers) 
Hi  Aleli Lopez,

try with below validation rule.
AND(ISPICKVAL(PicklistField__c,'IT'), OR(Java__c=false,Javascript__c =false))
If this helps,please mark it as best answer
This was selected as the best answer
Aleli LopezAleli Lopez

Thank you Md Thameem and Jayeshkumar Parmar for the response.
Here's the complete scenario.
I have 2 types of Record : Standard and IT.
Now, when I select Standard, my picklist should display "FIN", "HR", "RO", and "WR". Then I select IT, my picklist shoudl display "IT" and "MISC" only. 

When I select IT, my checkboxes (APEX, C#, Java, and Javascript) should be displayed and checked.

From Jayeshkumar response, this shows that checkbox should checked first before I select from picklist.

What I need to do is to select record type, select picklist. If I select Standard record type, checkboxes should not be displayed but when I select IT, checkboxes should be checked and displayed.

I hope this make my scenario more clearer. Thanks.

Jayeshkumar ParmarJayeshkumar Parmar
Hello Aleli Lopez,


For this type of requirement you need to overwrite the standard detail page with custom visualforce page, where you can show/hide the field on custom logic in script.


Please refer to the below link  exactly with similar issue.


Kindly modify the code as per your requirement which helps you surpass the above challenge.


RecordType based rendering in Visual Force Page (https://salesforce.stackexchange.com/questions/96188/recordtype-based-rendering-in-visual-force-page/96210
How to hide/show the fields based on Picklist value (https://salesforce.stackexchange.com/questions/101208/how-to-hide-show-the-fields-based-on-picklist-value)
 

If this helps,please mark it as best answer.


Thanks,
Jayeshkumar Parmar