1

My managed package creates custom fields and generates VF pages via Metadata API. Is there a way to create them under my package's namespace? (except for packaging those pages and fields:)

At the moment it looks like I'll have to stick with the client's namepace and create some global classes as wrappers for my old controllers. Please let me know if there is a better workaround for the namespace issue.

Thanks in advance

1

No, this isn't possible. The only way to get stuff into your package namespace is to put it into the package statically.

After a package is installed it's code can use Metadata/Tooling-API to create other Metadata components. This happens under the credentials of the specific Admin user who is installing or using the package. In other words it's like he has done it via the API say using eclipse. From his perspective the content of managed packages (even yours) is protected. Everything he creates will have no namespace prefix.

With only one exception: with metadata API you can install other managed packages. So you could pre configure something statically in different alternative packages. You still wouldn't end up into your primary package namespace but at least in a second namespace. It is very likely that this is not what you want because you'll loose all the dynamic you probably want including the ability to edit stuff later.

I have seen it always as an advantage to create stuff unprefixed:

  • Admins can edit it (this is also a risk)
  • Admins can decide what should be kept after uninstall of your package (a huge benefit in my opinion)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.