Saturday, January 24, 2015

Managed Package in Salesforce.

Managed Package in Salesforce.

Managed packages are created in much the same way as unmanaged packages, by navigating to Setup -> Create -> Packages. However, a namespace needs to be set as well.

A managed package that you produce must live alongside code that someone else may produce; it can, after all, be installed into anyone's organization. As a result, the platform demands that you create a namespace prefix. This prefix distinguishes your package and its contents from those of other developers. It is unique across all organizations, never changes, and is automatically prepended to all components.

For example: say you install a managed package that contains a Visualforce page called MyPage and a controller MyController, which has been placed in the XXX namespace. The Visualforce will then be available at a URL something like:

As a result the controller, an Apex class, will have the namespace prefix and the Visualforce page refers it as "XXX.MyController". The addition of namespace in all components installed with a managed packaged is handled automatically by the installation.

Implications of Managed Packages on Source Code

If someone installs a managed package, they don't get access to all the source code of that package. For example, if the package installs an Apex class, they will not be able to view the source code of that Apex class. Here is a list of factors that should be considered:

  • Apex class source code is completely hidden; unless the Apex class is a global class in which case the global method signatures and variables are exposed.
  • The source of Visualforce pages is not hidden. However, the source cannot beedited.
  • The source of Visualforce Components is hidden.
  • Trigger source code is also hidden.
Hence managed packages provide a strong form of IP protection.

Creating Managed Packages

Creating a managed package is just as easy as creating an unmanaged package. The only requirement to create a managed package is that you’re using a Developer Edition organization. 

Before creating a managed package:

  • Review the information about managed packages in the ISVforce Guide to determine if this is the right type of package for your app. 
  •  Optionally, install the License Management Application (LMA) from Search for License Management App to locate it. The License Management Application (LMA) tracks information about each user who installs your app. It allows you to track what users have which version, giving you a means of distributing information about upgrades.
The License Management Application (LMA) can be installed in any Salesforce organization except a Personal, Group, or Professional Edition organization and does not need to be the same  Salesforce  organization that you use to create or upload the package, although it can be. You can also use the same License Management Application (LMA) to manage an unlimited number of your managed packages in different Developer Edition organizations.

Configuring Your Developer Settings

The developer settings in a Developer Edition organization allow you to create a single managed package, upload that package to theAppExchange, allowing other users to install and upgrade the package in their organization. After configuring your developer settings the first time, you can no longer modify them. Regardless of the developer settings, you can always create an unlimited number of unmanaged packages.

To configure your developer settings:

1.  From Setup, click Create | Packages.

2.  Click Edit.
This button does not appear if you have already configured your developer settings.
3.  Review the selections necessary to configure developer settings, and click Continue.
5.  Choose the package you want to convert to a managed package. If you do not yet have a package to convert, leave this selection blank and update it later.
6.  Click Review My Selections.
7.   Click Save.

Registering a Namespace Prefix

In a packaging context, a namespace prefix is a one to 15-character alphanumeric identifier that distinguishes your package and its contents from packages of other developers on AppExchange. Namespace prefixes are case-insensitive. For example, ABC and abc are not recognized as unique. Your namespace prefix must be globally unique across all Salesforce organizations. It keeps your managed package under your control exclusively.

Salesforce automatically prepends your namespace prefix, followed by two underscores (“__”), to all unique component names in yourSalesforce organization. A unique package component is one that requires a name that no other component has within Salesforce, such as custom objects, custom fields, custom links, s-controls, and validation rules. For example, if your namespace prefix is abc and your managed package contains a custom object with the API name, Expense__c, use the API name abc__Expense__c to access this object using the API. The namespace prefix is displayed on all component detail pages.

our namespace prefix must:

  • Begin with a letter
  • Contain one to 15 alphanumeric characters
  • Not contain two consecutive underscores

To register a namespace prefix:

1.     From Setup, click Create | Packages.

2.     Click Edit.


This button does not appear if you have already configured your developer settings.

3.     Review the selections necessary to configure developer settings and click Continue.

4.     Enter the namespace prefix you want to register.

5.     Click Check Availability to determine if it is already in use.

6.     Repeat if the namespace prefix you entered is not available.

7.     Click Review My Selections.

8.     Click Save.


Specifying a License Management Organization

 A license management organization is a Salesforce organization that you use to track all Salesforce users who install your managed package. The license management organization receives notification (in the form of a lead record) when a user installs or uninstalls your package and tracks each package upload on AppExchange.

Your license management organization can be any Salesforce Enterprise, Unlimited, Performance, or Developer Edition organization that has installed the free License Management Application (LMA) from AppExchange. To specify a License Management Organization, go to

Per-Transaction Certified Managed Package Limits 
Certified managed packages, that is, managed packages that have passed the security review for AppExchange, get their own set of limits for per-transaction limits with the exception of some limits. Certified managed packages are developed by Salesforce ISV Partners, are installed in your organization AppExchange, and have unique namespaces.

Here is an example that illustrates the separate certified managed package limits for DML statements. If you install a certified managed package, all the Apexcode in that package gets its own 150 DML statements, in addition to the 150 DML statements your organization’s native code can execute. This means more than 150 DML statements might execute during a single transaction if code from the managed package and your native organization both execute. Similarly, the certified managed package gets its own 100 SOQL queries limit for synchronous Apex, in addition to the organization’s native code limit of 100 SOQL queries, and so on.
All per-transaction limits count separately for certified managed packages with the exception of:

  •  The total heap size
     The maximum CPU time
     The maximum transaction execution time
     The maximum number of unique namespaces
These limits count for the entire transaction, regardless of how many certified managed packages are running in the same transaction.

Also, if you install a package from AppExchange that isn’t created by a Salesforce ISV Partner and isn’t certified, the code from that package doesn’t have its own separate governor limit count. Any resources it uses counts against the total for your organization. Cumulative resource messages and warning emails are also generated based on managed package namespaces as well.

For more information on Salesforce ISV Partner packages, see Salesforce Partner Programs.


Post a Comment

| ,