Skip to main content
All CollectionsTroubleshootingSalesforce validation errors
Resolving validation errors - "The approver null has an invalid type. Replace PreviousApprover with a valid enumeration value"
Resolving validation errors - "The approver null has an invalid type. Replace PreviousApprover with a valid enumeration value"

Cause and solution for this Salesforce validation or deployment error

Mateusz Kochanowicz avatar
Written by Mateusz Kochanowicz
Updated over a week ago

Error overview

This Salesforce error may surface when you've made a change on the ApprovalProcess, for example by adding an approval step.

An example of the error message in our app:
"The approver null has an invalid type. Replace PreviousApprover with a valid enumeration value"

Explanation of the error

It may be that the approver in Salesforce UI (source environment of the deployment) is filled and has an active user in it.

But when you look at the Approval process metadata type of the failing component within Gearset comparison results (in below example it is Moneyback__c.Consumer_PartialAppeasement_SeniorMgr1), you may notice that its XML shows <type>PreviousApprover</type> on one of the lines.

This is likely to fail your validation because 'PreviousApprover' appears to be recognised as an invalid type by Salesforce.

Resolution

To resolve the error, if possible consider removing <type>PreviousApprover</type> from the XML file before you attempt to re-deploy the changes.

If the source environment is a Git branch, you can use VS Code, or a similar XML editor, to edit the XML file of the failing component.

If the changes to XML cannot be made, try to amend the PreviousApprover to Queue on the ApprovalProcess in the Salesforce org from which changes are being migrated.

Also, note that the PreviousApprover can't be a valid option for the first step approval because, in such case, there is no previous approver. This is another reason why Salesforce may surface this error when it thinks that the value would be null.

Disclaimer: This error is returned by Salesforce directly, rather than Gearset. Even so, we offer guidance based on our combined experience with the Metadata API. Where possible, we try to help guide you to fix or avoid this error. In the case that this isn't possible, we may need to direct you to Salesforce support for further clarification.

Did this answer your question?