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
Javier CGJavier CG 

Create a validation rule comparing with a long list of values

I have to create a validation rule (VR) comparing with a list of values (IDs in my case).
The list is long so I can´t write all the values in the VR and I think that is better to make the list dynamic through custom metadata types, but I can´t find the way to do this.
Is this solution possible or exist another option that I didn´t think about?
I prefer a declarative solution instead of a coded one for ease maintenance.
ANUTEJANUTEJ (Salesforce Developers) 
Hi Javier,

I tried checking if there are any implementations to vr for large number of fields but unfortunately I was not able to find any such implementations however, when checking the documentation I see that the character limit for a vr is 255 characters as you have mentioned you need to validate more number of fields I would suggest trying a custom code snippet to check below is a link to validation using a trigger.

Link: https://developer.salesforce.com/forums/?id=9060G0000005OeVQAU

I hope this helps and in case if this comes in handy can you please choose this as the best answer so that it can be useful for others in the future.

Regards,
Anutej