Add support for running pre-existing validation rules for the given SObject type
Wow. After years of having to toggle through the branch list after kind of remembering there was code somewhere in this repo - it’s an exciting day to come here and see the first official release. Which means that it’s time to take this crazy train off the rails by making your validation rules reference validation rules!
it would be awesome if, by adding a CMDT of a certain type, you could run all (and/or subsets) of the actual validation rules for a given SObject. That info is available via the Metadata API (though it wasn’t clear to me in my ~5 second look around if you could filter by SObject with the data exposed for ValidationRule there; I know you can with the Tooling API but that has its own fun limitations). Anyway, I feel like that functionality would really round things out around here, and would probably springboard this repo into widespread usage!
I love this idea, it'd be great to see if it's feasible to get this working (and hopefully it won't take 3 years 😆 ). I looked into the Tool API option briefly, and you're definitely right that it has some limitations. The first one I ran into is that you can filter on the SObject type (EntityDefinitionId), but it's a string field, not an Id field, so you can't use inner queries or dot notation... that's a bit goofy, we'll have to do a prototype for using the Metadata API to see if it's better
SELECT Id, FullName, EntityDefinitionId
FROM ValidationRule
// This won't work since EntityDefinitionId
WHERE EntityDefinitionId IN (select Id from EntityDefinition WHERE FullName IN ('Account'))