AdvoLogix Help

Duplicate Field Error When a Custom Field API Name Matches a Packaged Field Name (MM)

Updated on

Article #000001026

Summary

Historically, Salesforce does not identify a field when referenced in code as part of a managed namespace package. So, when we execute a query to retrieve certain fields for some records, we just add our managed fields to the query and execute to retrieve the data. This is when the trouble begins.  When the user creates a custom field on the object with the same name, this causes two fields with the same name on the object, the only distinction being a namespace that is unique to ISVs (our package) and applies it to our packaged field only. Since the platform wasn't distinguishing the two fields based on a namespace and it recognizes the two fields with the same name and when we execute our query for data retrieval, it causes an error that is a hard limit for the platform, such that no field can be duplicated in a query. 

Question

Why do I get a duplicate field selected error? 

Duplicate field selected advpm__xxxxxxxx__c

Resolution

Field API names can't be duplicated because Salesforce doesn't include the field namespace when evaluating dynamic query logic. 

Workaround

These field names have to be re-named in order to prevent errors. 

Previous Article Matter Calendar: Unable to View Events Created Using the Repeat Checkbox (MM)
Next Article Users Unable to Log In Without an Error (MM)
Still need help? Click here!
AdvoLogix® is a registered trademark of AdvoLogix.com LLC a Texas Limited Liability Company. All references to other trademarks belonging to third parties that appear on this website, documentation, or other materials shall be understood to refer to those registered trademarks owned by others, and not to any trademark belonging to AdvoLogix. Otherwise, all material herein is the copyright of AdvoLogix.com LLC. All Rights Reserved.