4

So I've been looking around to see if there is a way to push Apex Classes via the Metadata API, and I'm a little confused at the documentation. I've used the Eclipse plugin before, so I know that you can absolutely create Apex Classes through the API, I'm just not sure how to do that via Apex.

I've been reviewing this hear https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_classes.htm. It looks like they have some fields that you can set the name, and some other fields, but it looks like all of the content is coming from the base64 encoding. Is there a way that I can send the content over without generating a zip file?

Use case is this - I have a need to have a custom button or tab that will call an apex class that will query for all apex classes and their logic, then push to another Salesforce org via the metadata API.

  • 1
    So you want to create your own "Change set" functionality. That's interesting. – Mr.Frodo Apr 25 '17 at 14:44
  • In a way, yes. The theory is that it'll pull from another Salesforce org (or GIT) and pull all of the api accessible metadata into the new org. – Ryan Apr 25 '17 at 14:50
  • 2
    There is a Metadata REST API that doesn't depend on ZIP files, as well as the Tooling API, which is REST-based and uses similar interface. – sfdcfox Apr 25 '17 at 14:50
  • 2
    Only Limitation is Tooling cant be used in Prod to deploy :) – Pranay Jaiswal Apr 25 '17 at 14:54
  • I don't think we'll be using it to deploy in Prod, it'll only be used to deploy to sandboxes. – Ryan Apr 25 '17 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.