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
Arun KArun K 

Doubt in handling Managed Package

We are having a requirement wherein our application is being deployed as a Managed Package on a customer's org. We need to access some of the objects in the org's 

schema within our Managed Package. However, any references to fields outside the Managed Package is leading to creation of duplicate fields (with namespace of the 

Managed Package appended) on deployment of the Managed Package. For example, in one of my classes we are referring to a field 'Role_c'in the account object. When I 

deploy the Managed Package, there is another field <namespace>__Role_c created in the object and this new field is referenced within my class. Is there a way to refer 

to fields outside the Managed Package without creating these duplicate fields?
bob_buzzardbob_buzzard
Unless they are standard fields the short answer is no.  Your package needs to contain everything it relies on, so it can't expect there to be custom objects/fields available in the org.

You can decouple your code from these objects/fields by using dynamic SOQL/DML and treating everything as generic sobjects, but if your managed package is public you may struggle to get this through the security review.