Adding Apex Code to a AppExchange App

You can include an Apex class or trigger in an app that you are creating for AppExchange.

Any Apex that is included as part of a package must have at least 75% cumulative test coverage. Each trigger must also have some test coverage. When you upload your package to AppExchange, all tests are run to ensure that they run without errors. In addition, tests with the@isTest(OnInstall=true) annotation run when the package is installed in the installer's organization. You can specify which tests should run during package install by annotating them with @isTest(OnInstall=true). This subset of tests must pass for the package install to succeed.

In addition, Salesforce recommends that any AppExchange package that contains Apex be a managed package.

For more information, see the Quick Reference for Developing Packages. For more information about Apex in managed packages, see “What is a Package” in the Salesforce online help.

Note

Note

Packaging Apex classes that contain references to custom labels which have translations: To include the translations in the package, enable the Translation Workbench and explicitly package the individual languages used in the translated custom labels. See “Custom Labels” in the Salesforce online help.