I have a new implementation where i want the fields and objects to have a prefix (e.g. ggtest_ ). However, this is neither a managed package nor a solution that is going to be as a partner. We also use many Sandboxes, and i wonder.... What is better? Is it a good choice to set a prefix from package manager in order to get the prefix automatically? Or i should create all the fields typing the prefix? What is the best ?
1 Answer
A prefix that you see followed by two underscores is a namespace.
You cannot use a namespace unless you are building namespaced packages, whether those are first-generation packages or namespaced unlocked/managed second generation packages. The latter would be applicable to your scenario since you are not building ISV packages for the AppExchange.
What is better? Is it a good choice to set a prefix from package manager in order to get the prefix automatically? Or i should create all the fields typing the prefix? What is the best ?
Either design your development process around building packages using the Package Development Model and use namespaces there, or don't use namespaces/prefixes. You cannot apply a real namespace (with two underscores) by hand if you're not building a package.
If you're doing greenfield development, adopting unlocked packages is a great decision for you to make at the start of your project.
You can use whatever string you want as a prefix, not a namespace, so long as it complies with API name limitations. I consider this to be of limited utility at best, because it provides you no actual control over the pseudo-namespace's content, and hence doesn't give you much protection against collisions. It also makes your schema much more verbose, meaning it takes more typing to work with and consumes more characters of Apex code space, for little real gain.