function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gsarguccigsargucci 

Namespace prefixes

Hi,

 

This is really a follow-up to another question for which I've been unable to get a response.  Sorry for reposting.   I'm a little confused about the namespace prefixes and their usage in Apex.  The docs for namespaces say:

 

Salesforce automatically prepends your namespace prefix, followed by two underscores ("__":smileywink:, to all unique component names in your Salesforce 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.

 

Is the 'API' referred to here the 'client' API?  For example if I want to expose a Web Service and call it from Java, I'd have to use the namespace prefix in the call.  Or do I somehow have to reference the namespace prefix in the Apex code?  I'm assuming it's the former, because the latter doesn't seem to make much sense--since the namespace would change from org to org as the package gets inistalled in different orgs, I couldn't really reference it in the Apex code.  Or am I missing something?

 

Thanks!

SuperfellSuperfell
If you create a managed package with the namespace abc, the namespace is applied to all the components for every install, e.g. its abc__bob__c in every org that installs the package.