A namespace prefix distinguishes your package and its contents from those of other Apex developers. A namespace prefix is globally unique across all salesforce.com organizations. It keeps your managed package under your exclusive control.
Salesforce.com automatically prepends your namespace prefix, followed by two underscores , to all unique components in your salesforce.com organization. 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.
Using the Default Namespace
If your organization hasn’t set a namespace prefix, use the default namespace c when referencing Lightning components that you’ve created.
The following items must use the c namespace when your organization doesn’t have a namespace prefix set.
- References to components that you’ve created
- References to events that you’ve defined
The following items use an implicit namespace for your organization and don’t require you to specify a namespace.
- References to custom objects
- References to custom fields on standard and custom objects
- References to Apex controllers
The Salesforce application supports the use of namespace prefixes. Namespace prefixes are used in managed Force.com AppExchange packages to differentiate custom object and field names from those in use by other organizations. After a developer registers a globally unique namespace prefix and registers it with AppExchange registry, external references to custom object and field names in the developer’s managed packages take on the following long format:
Because these fully-qualified names can be onerous to update in working SOQL statements, SOSL statements, and Apex once a class is marked as “managed,” Apex supports a default namespace for schema names. When looking at identifiers, the parser considers the namespace of the current object and then assumes that it is the namespace of all other objects and fields unless otherwise specified. Consequently, a stored class should refer to custom object and field names directly (using obj_or_field_name__c) for those objects that are defined within its same application namespace.
Your namespace prefix must:
- Contain 1-15 alphanumeric characters; for convenience, you may prefer a short length
- Begin with a letter
- Not contain two consecutive underscores
Once your namespace prefix is set, it cannot be changed.
To register a namespace prefix:
- From Setup, enter Packages in the Quick Find/Search , under Create select Packages.
- In the Developer Settings panel, click Edit.
- Review the selections that are required for configuring developer settings, and then click Continue.
- Enter the namespace prefix you want to register.
- Click Check Availability to determine if the namespace prefix is already in use.
- If the namespace prefix that you entered isn’t available, repeat the previous two steps.
- Click Review My Selections.
- Click Save.
“Explore – Techila Global Services, A Salesforce development company”