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
Bharath Kumar Reddy GunnaBharath Kumar Reddy Gunna 

validation multi

I need a validation rule for Multi Picklist to prevent users from uploading values other than the defined Multiselect picklist values.

For example I have 5 values defined for MSP, howwever users can upload any othe values from API and I need to restrict that.

Thanks
KaranrajKaranraj
Hi Bharath - Try with the combination of INCLUDES with IF condition. Check the below validation rule
IF(INCLUDEs(MSP__c,'value1'),False,
   IF(INCLUDES(MSP__c,'value2'),False,
      IF(INCLUDES(MSP__c,'value3'),False,
         IF(INCLUDES(MSP__c,'value4'),False,
            IF(INCLUDES(MSP__c,'value5'),False,True)
         )
       )
    )
)

Thanks,
Karanraj


 
Bharath Kumar Reddy GunnaBharath Kumar Reddy Gunna

Hi Karanraj,

Thanks for your help, however this only works when all the values are out of the standard values.

i.e.
A; B ; C - validation works
A; value2; B - validation do not work, since the execution ends at IF(INCLUDES(MSP__c,'value2'),False, which is False.
KaranrajKaranraj
Try the update formula, hope it should work 
OR(
IF(INCLUDES(MSP__c,'value1'),False,True),
IF(INCLUDES(MSP__c,'value2'),False,True),
IF(INCLUDES(MSP__c,'value3'),False,True),
IF(INCLUDES(MSP__c,'value4'),False,True),
IF(INCLUDES(MSP__c,'value5'),False,True)
)