function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SkiesnPiesSkiesnPies 

Interrogating Approval Process's Prior Via Apex

Is it possible to traverse the configuration objects in APEX script? 

 

I would like run a trigger from the USER object which checks to see if the user appears on any approval configurations before I allow the user record to be made in-active (I don't mean check to see if they have OUTSTANDING approvals but I mean check if they could ever appear on ANY approvals in the future - ie. are they listed in any approval steps). 

 

Does Salesforce expose these objects to developers? I have had a search for these objects but the only ones I can find relating to approvals relate to firing off and managing an approval process on an existing object. 

 

Note: a bit of an APEX newbie alert (been a developer for years but new to APEX and quite new to SF). :smileyhappy:

 

Thanks in advance. 

Best Answer chosen by Admin (Salesforce Developers) 
sfcksfck

I believe it is not possible. I went through this recently in regard to validation rules - wanted to interrogate them in order to create test data that satisfied them (in order to have a even a hope of writing portable tests). They are not exposed to Apex.

 

Coming from other programming languages / environments it is easy to forget what a small yard Apex developers get to run around in. Kind of like VBA, but a little more restrictive.

All Answers

sfcksfck

I believe it is not possible. I went through this recently in regard to validation rules - wanted to interrogate them in order to create test data that satisfied them (in order to have a even a hope of writing portable tests). They are not exposed to Apex.

 

Coming from other programming languages / environments it is easy to forget what a small yard Apex developers get to run around in. Kind of like VBA, but a little more restrictive.

This was selected as the best answer
SkiesnPiesSkiesnPies

Thanks SFCK, I feared that this would be the case after my R&D and browsing through the object model. Good to have it confirmed by somebody though before I break the news to the client. 

Thanks again. 

J