0

I have a Multipicklist P1 with values 2,3,4. Now we have to introduce another picklist values a,b,c,d,e,f , which should be a dependent picklist for the first one. But I cannot afford for changing the above to picklist from multipicklist as that would be a data loss for previous/old records. So without changing its type how can I achieve this dependency relationship among those two picklist.

0

You can go for a Before Insert/Update trigger. Else you can simply write a validation rule i.e., If value 2 is selected in picklist1 and if the values are not equal to what is required then throw an error. This way you can avoid users enter wrong combination values in those picklists.

Try the below validation, I have written only for two conditions

AND(OR( 
NOT includes(Test_Parent__c,"2"), 
AND (NOT includes(Test_Dependents__c,"a"), 
NOT includes(Test_Dependents__c,"b"), 
NOT includes(Test_Dependents__c,"c"), 
NOT isblank(Test_Dependents__c) 
) 
), 
OR( 
NOT includes(Test_Parent__c,"3"), 
AND ( 
NOT includes(Test_Dependents__c,"d"), 
NOT includes(Test_Dependents__c,"e"), 
NOT includes(Test_Dependents__c,"f"), 
NOT isblank(Test_Dependents__c) 
) 
) )

Basically it checks, If P1 equals 2 and If P2 not equal to OR does not contain a/b/c there will be an error. Likewise you can construct your validation rule.

  • Both are multipicklist, still is it doable using validations – SFDev Dec 5 '16 at 9:40
  • Please my edited answer if it suits your requirement – C. Praveenkumar Dec 5 '16 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.