I'm trying to search and replace all validation rules in vs code. I ONLY want to retrieve validation rules, and not the entire object. I know this is possible using the xml package, however I'm hoping there is an easy way to retrieve all validation rule names as I can't use the * wildcard to get all validation rules.

I've seen and tried suggestions using workbench, but always get an error.

Is this possible?

Current package xml that successfully retrieves one validation rule:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">


Screenshot of error when running


In Rest Explorer WOrkbench Error


You should be able to retrieve all validation rule metadata using the Metadata API

What I would do is create a Package.xml and retrieve all ValidationRule Metadata Validation Rules cannot be described by the wildcard character (*) so you will have to name them individually.

I believe adding the following will work:


Make your changes and then deploy.

If you wanted to query the validation rule info, you can indeed use workbench: click on:

Info --> Metadata Types and Components --> Select ValidationRule

For what its worth, Here is a link the ValidationRule Metatdata API Names To help maybe export the list of all VR names, You can also Query the names in the dev console query editor using the following query:

Select Id, ValidationName, Active,Description,EntityDefinition.DeveloperName,ErrorDisplayField, ErrorMessage From ValidationRule

Make sure you check the little box that says tooling API. You can then export the results to a csv:

There may be a simpler way, but I hope that helps

| improve this answer | |
  • 2
    Validation Rule cannot be described with the Wildcard character developer.salesforce.com/docs/atlas.en-us.218.0.api_meta.meta/… – Bryan Anderson Jan 17 at 16:41
  • I tried the wildcard for ValidationRule in vscode and it came back with no results. I didn't know about the info > metadata types and components. Is there a way to export that info or view it in xml format? Ideally, I'm looking for an easy to to build an xml package with all our validation rules (and not all objects). I haven't found a good way yet. – jameskbw Jan 17 at 16:51
  • @BryanAnderson thanks for the catch. I updated the answer – Z33dawg Jan 17 at 17:32
  • @jameskbw see updated answer, I found a way to query the names using the 'ValidationName' (see above – Z33dawg Jan 17 at 17:55
  • @Z33dawg I appreciate the updates. This query does work to get me all the validation rule names. I still seems I'll need to do a lot of copying and pasting to build the xml package. I was hoping there was a more straight forward way of doing this repeatedly but there doesn't appear to be. – jameskbw Jan 17 at 18:34

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.