With the Metadata API, I have access to create visualforce pages and apex classes in Salesforce.

Doesn't this provide an alternative to Appexchange app? Instead of building my apex app and ask users to install it, I can ask them to OAuth on my web app and create all the classes and pages using Metadata API.

What are the pros and cons of this approach?

  • Appexchange is a store like Apple Store/Google play. You can't achieve such behavior only by Metadata API. You must be trusted.
    – Ashwani
    Jan 25, 2017 at 6:13
  • @vishesh If you are satisfied with the provided answers, please mark one as correct to close the question, if you are looking for anything specific please update your question.
    – Mr.Frodo
    Jan 27, 2017 at 7:46

4 Answers 4


Drawback list:

  1. You are not trusted as Appexchange
  2. Your code is not safe as it is editable
  3. You can't protect your intellectual property. I know you approach I will modify and re-use the approach and build better app than you.
  4. Appexchange does marketing also (a little but considerable). This will not happen by your own appexchange
  5. There is no guarantee how much your app is secure. No company will take this risk.
  6. Professional edition doesn't support Metadata API. You will have limited access to Salesforce editions.
  7. No visibility of how good/bad your app is performing.
  8. Salesforce won't help you much regarding that app as its not listed on their store. It is nothing more than an implementation. No partner benefits.
  9. Application will be counted against subscriber org limits. Impact as point #6.

Three obvious drawbacks I can think of in this approach:

  1. The source code you deployed into client side are all visible to your clients. And they can actually modify your code. And there isn't much a way you can protect your code. That's almost a show stopper.

  2. You won't be able to get the analytics App exchange provided - including how many times a Visualforce page is clicked, how many times an object is created, etc. You can mitigate this issue by injecting your own code into VF page, but this can be a pain.

  3. Also, I don't think you can generate Apex code directly in production org as well.

So, in short, don't use this approach.

  • Thanks Lance. I am not planning to use this approach. Just wanted to know if this could be an approach?
    – vishesh
    Jan 25, 2017 at 6:15
  • @vishesh Since you can't protect your code, I don't think it is though.
    – Lance Shi
    Jan 25, 2017 at 6:16

It looks out of the box thing on first look but it's not that much good approach. Probably the only benefit you will have with this approach that you can update your classes at any time.

But major disadvantage of this approach are following:

  1. It does not provide any kind of security in terms of who can see your code.
  2. Generally using Metadata api requires View all and Modify all permissions which are too much privilege for an API user. No client would compromise their security by providing these permissions.
  3. It will become hard to manage when there will be lot of clients. With Manage Package approach you can keep your client on different versions but then probably every small change would require lot of brainstorming.
  4. It would not give any benefit in terms of LIMITS imposed by salesforce. If you are aware then you know that there are lots of limits which are separately counted in case of manage package.

In addition to what others have already said, if you're looking for an alternative to an AppExchange app, you can always create an unmanaged package and distribute it anyway you like.

Metadata API seems like overkill. Installing an unmanaged package is nearly as easy for the user.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .