How can I get list of all workflow rules using apex?

How can I get list of all workflow rules using apex?
I want to retrieve names of all workflow rules using apex code.


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I haven’t done it myself, but I think you could call the metadata api from apex and than process the output.

Method 2

Unfortunately I believe you would need to use the Metadata API for this, which requires processing outside of Apex (from Heroku in Python/Ruby, for example). However, if there’s a way to get this done from within Apex, I’ll be really happy to learn about it!

Method 3

I’ve been successful in getting parts of the Metadata API working from Apex using the WSDL2Apex tool and a few tweaks! However the listMetadata operation in respect to Workflow does not quite return what you would expect. Take a look at this answer for more info. Hope this helps!

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x