1

I am trying to add a validation rule on a multi-select picklist field to avoid any invalid value to be updated on the record. You might be guessing how an invalid value can be selected for a picklist. And the answer is, we can update any kind of junk values on a picklist field using data loader, Apex or API call and the system will let you do that...

So to give an example of what I am trying to achieve, lets say I have a custom mulit-select picklist field 'Color__c' and the available picklist values are "Red", "Blue" and "Green". If any of the above mentioned processes(data loader, Apex or API call ) tries to update the Color__c field with a value other than the above three, it should fail. So a "Red;Yellow", "Blue;White", "Green;Black", "Magenta;Pink" are all invalid entries and should throw a validation error. I have tried all the OR/AND/INCLUDE combinations but may have missed the one that will catch this requirement. Is this achievable through a Validation Rule or I have to do this validation in a Trigger ?

Any help in this regard would be appreciated!

Thanks Tom

3
  • Check this. success.salesforce.com/answers?id=90630000000h1cIAAQ
    – SL man
    Commented Oct 20, 2015 at 19:54
  • It sounds like if you're concerned about data imports, part of the issue is that you should be validating the data-quality of the imports before actually absorbing them. I understand that bad data happens, but there are best practices for data loads that should be evaluated as well, imho.
    – HomerJ
    Commented Oct 20, 2015 at 20:42
  • @SLman - the linked answer only validates count of valid values; not count of invalid values
    – cropredy
    Commented Oct 21, 2015 at 1:23

1 Answer 1

0

Maybe this type of validations must be created in a trigger, because usually the ways that you mentioned to modify the existing values work directly with the data base, my suggestion is try to create a simple trigger before insert to validate that the value that the process is trying to save in the table is a valid value include in the field. Regards.

You must log in to answer this question.

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