Hi everyone,
We are reaching out for guidance on a namespace conflict issue we are facing in our SharinPix managed package.
In our managed package, we have a custom object named Job__c. One of our customer orgs also has an unmanaged custom object with the same API name: Job__c.
In Apex, we derive the object name from the customer’s record Id:
recordId.getSObjectType().getDescribe().getName()
This returns Job__c, and the record Id belongs to the customer’s unmanaged object.
However, when we execute dynamic SOQL from within our managed package, FROM Job__c resolves to the SharinPix managed package object. We understand this is the default Salesforce namespace resolution behavior in a managed package context.
Has anyone found a reliable workaround for this? Is there any supported way to explicitly query the subscriber/default-namespace object from managed package Apex when both objects have the same API name?
Thanks a lot
cc:
@Kevan Moothien
#AppExchange
This is a known limitation of namespace resolution in managed packages. Within managed package Apex, unqualified object names resolve to the package namespace first, so dynamic SOQL against Job__c will target the packaged object when both exist.
Unfortunately, there's no supported way to force dynamic SOQL to resolve to the subscriber's unmanaged object in this scenario. A common workaround is to avoid API name collisions altogether or use another identifier (such as the object's namespace or describe metadata) to differentiate the objects where possible. If this is a blocker, Salesforce Support may be able to confirm whether there are any newer platform capabilities or known workarounds.