INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST error can occur during a data deployment if the metadata of your source org doesn’t match the metadata of your target org.
What causes the error?
This error occurs if a record in your source org includes a value from a restricted picklist and the same picklist value does not exist in your target org. Restricted picklists constrain the picklist values that can be selected to those in the value set. This is in contrast to unrestricted (or “advisory”) picklists, which accept any value as valid that is entered or selected by the user. Whether or not a picklist is restricted is determined by the
restrictedPicklist field and can be set with a checkbox from the Salesforce UI.
Lists of values for restricted picklists are enforced by the Salesforce API, which means that the source record cannot be deployed if the specified picklist value isn’t available in the target org. Records containing an invalid picklist value cause Salesforce to throw the
INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST error that Gearset displays as follows:
How do I fix the error?
The main way of avoiding this error is to make sure that your source and target orgs contain the same metadata with identical picklist values available in each org. You could do this manually by logging into your source org and checking what picklist values are available before logging into your target org and checking that the same values exist there too. Alternatively, you can run a quick metadata comparison between your orgs in Gearset and deploy the picklist if there are any differences. You can then deploy your data with Gearset’s data loader. Of course, you also always have the option of simply filtering and excluding the record(s) that give rise to the error.