I want to check whether a field is used in the entry criteria of approval process through apex code. Can I retrieve the entryCriteria from ApprovalProcess?
As far as I have known, it is not possible to do retrieve entry criteria through Apex. Salesforce help page that tells about the metadata api to get info about Approval Process.
There is no easy way to get that data in APEX and get it going. So we had to come up with a different approach.
We created a formula field which we query in apex that will tell us if it is eligible to be added to an approval process.
The only overhead is if the Approval criteria changes, we have to update the formula. (Which is fine as Approval entry criteria isn't something that's changed every day')
We added an extra layer of CI/CD validations that will alert us if Approval entry criteria are changed it will trigger emails denoting devs to change formula fields as well.