0

Database.query() takes query as a string, and we used this to build queries dynamically in our managed package, to query custom objects of installed organizations.

We have objects in our managed package with API names like 'Billing_Event__c'. Namespace (test__).

We used dynamic query in our Apex which will query customer's custom objects dynamically based on the Id they pass to us, but if their custom object name matches with our managed package object names (i.e they have object name as "Billing_Event__c"), Database.query() now retrieving managed package objects instead of retrieving customers' custom objects.

Schema Global Describe as well returning managed package objects.

This was not the case previously, Database.query() was retrieving records whenever the API names matches with object name, so if we have to query our own managed package objects we had to include namespace like 'test__Billing_Event__c'.

Can any one help to use dynamic query to get customers custom object. i.e results of Billing_Event__c not test__Billing_Event__c.

0

Not enough reputation to add a comment.. Anyways, this is similar to your issue : SObjectType name conflict in queries. There is even an idea for this as mentioned in the above link https://success.salesforce.com/issues_view?id=a1p30000000T3V2AAK

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.