What is the simplest & easiest way available to access the Metadata API from APEX (accessing the current Org) ?
2 Answers
Salesforce have released direct support from Apex with Summer 17. Refer to: https://developer.salesforce.com/blogs/engineering/2017/05/introducing-apex-metadata-api.html
If you had simply searched google for your very question title, you would have found the answer:
Apex Wrapper Salesforce Metadata API
Documentation
In addition to the documentation in this README, the following blogs also cover the library.
- Automating the Creation of Flow Screens with Apex Metadata API
- Apex Metadata API Q&A
- Apex Metadata API Streamlined and Simplified for Summer’14
- Post Install Apex Metadata API Configuration Solved!
- Apex Metadata API and Spring’14 : Keys to the Kingdom!
- Introduction to calling the Metadata API from Apex.
- Spring’14 Pre-Release : Updating Layouts in Apex
- “Look ma, no hands!” : Automating Install and Uninstall of Packages!
- Scripting the Apex Metadata API and Batch Apex Support
- Apex Metadata API Spring’13 Update : Org Settings Access
This API mirrors as much as possible the API types and operations described in the standard documentation. The behaviour and functionality provided is also as described in the Salesforce documentation, in terms of what metadata is available and accessable via the specific operations.
-
5On a related note, Salesforce has started working on metadata updates via Apex. Until that's delivered though, the metadata api wrapper is pretty much the only decent solution.– Derek FMar 20, 2017 at 14:12
simplest
and/oreasiest
are also red flags for an opinionated question.