0

I have one controlling picklist of subject and dependent picklist teacher. On the basis of subject picklist teacher picklist changes. I want that teacher field should be required only when teacher picklist have some values to select, if it does not have any values it should not be required.

How can I implement it declaratively?

2 Answers 2

3

We can't make a field conditionally required on page layout or in the field definition. You'll have to create a validation rule that will fire when record is saved. And I'm not aware of any way to learn in formulas "how many options are available"

Looks like you have to go the hard way, base the validation on Subject and remember to keep them in sync every time you modify picklist dependencies, record types etc?

ISPICKVAL(Subject__c, 'Some option that you are sure means something is selectable on Teacher') ||
ISPICKVAL(Subject__c 'Another one like that') ||
ISPICKVAL(Subject__c, 'Another')
0
1

I am not sure what you mean by Declerative, but you can add a Validation rule on the teacher field, with logic being on the Subject

Something in the area of:

AND (NOT ( ISPICKVAL (Subject_c, ""))), ( Teacher_c = ""))

0

You must log in to answer this question.

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