0

I have a checkbox field and a picklist field. If the checkbox is checked than I want the user to have something selected from the picklist.

I started creating field dependency where the controlling field would be checkbox, and the dependent field would be my picklist.

But the problem here is

1. If checkbox is checked and if you don't select anything in picklistg it still allows you to save.

2. If the checkbox is not checked than the picklist option is grayed out.

I want the user to always see the picklist, but force him to select something from the picklist when the user has checked the checkbox.

Is there any validation rule I can work around ?

1 Answer 1

6

You can use a Validation Rule. Check:

  1. If checkboxfield is checked

  2. If the picklist value is blank

You can have a custom error "Picklist required if checkbox is selected" to show up on the screen using the formula below

AND (
    checkbox_field,
    ISBLANK(TEXT(picklist_field))
    )

If you want to further drill down and check if the picklist = "specific value" you can use

eg: if the checkbox is selected and if value of the picklist is "abc" then the validation throws an error.

AND (
    hidden_field__c,
    ISPICKVAL(picklist_field,"abc")
    )
2
  • 4
    (1) You don't need to compare to true (you're just wasting compiled formula space), (2) You can also make a dependent picklist between a checkbox and a picklist, which provides immediate visual feedback to the user that the picklist will be required.
    – sfdcfox
    Nov 13, 2014 at 18:04
  • @sfdcfox valid point on 1) updated the answer on 2) the op wants to force his users to chose one of the options from the pick list, when you go dependent picklist route you can only include or exclude values as the user mentioned in his question. how would you force the user to save unless you use a validation rule along with the dependent pick list route.
    – Rao
    Nov 13, 2014 at 19:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .