4

I created a new field on user in production environment and assign the field to Search Layout->User Lookup Phone Dialogs, after doing this I pulled the meta-data for this environment and checked the meta-data for ans see something like below;

<searchLayouts>
    ...
    <lookupPhoneDialogsAdditionalFields>00N1300000BKpiN</lookupPhoneDialogsAdditionalFields>
    ...
</searchLayouts>

I was expecting my field's API name to be there as "Other_Phone__c" but I got the Id value for the field instead.

What could be the cause for this?

2

After playing around with this a bit in my dev org, this occurs when no customizations have been made to the Lookup Phone Dialogs on the Search Layouts of an object and custom phone numbers are introduced. Steps to repeat experiment:
On User Object with the default Search Layouts Lookup Phone Dialog intact, create a new custom field User.Other_Phone__c. If you look at the Lookup Phone Dialog Layout you will notice the field was automagically added. You will also notice the field Id is pulled down in the metadata vs the api name.

<lookupPhoneDialogsAdditionalFields>CORE.USERS.CELL</lookupPhoneDialogsAdditionalFields>  
<lookupPhoneDialogsAdditionalFields>00N1a000006ckuc</lookupPhoneDialogsAdditionalFields>

Manually relabel the Id to the API name and deploy, then refresh metadata from server and API name sticks.

Just to ensure metadata changes and API name is used, modified the order in the UI of the phone fields and refreshed again from server.

<lookupPhoneDialogsAdditionalFields>Other_Phone__c</lookupPhoneDialogsAdditionalFields>  
<lookupPhoneDialogsAdditionalFields>CORE.USERS.CELL</lookupPhoneDialogsAdditionalFields> 

Added another custom phone field Another_Phone__c and refreshed from server. API name was automatically used. Experimented on the contact object and modified the layout first before adding the custom field and the API name was used vs the Id.

<lookupPhoneDialogsAdditionalFields>Other_Phone__c</lookupPhoneDialogsAdditionalFields>  
<lookupPhoneDialogsAdditionalFields>CORE.USERS.CELL</lookupPhoneDialogsAdditionalFields> 
<lookupPhoneDialogsAdditionalFields>Another_Phone__c</lookupPhoneDialogsAdditionalFields>

A report of this issue can be found back in 2013 so it does not appear to be a new issue but in my mind it is a bug or else there should be mention of it in the Metadata API Developer's Guide. Currently states the following:

The list of fields displayed in a lookup dialog for the object. The name field is mandatory and is always displayed as the first column header, so it is not included in this list; all additional fields are included. The field name relative to the object name, for example MyCustomField__c, is specified for each custom field.

Salesforce objects often include one or more lookup fields that allow users to associate two records together in a relationship. For example, a contact record includes an Account lookup field that represents the relationship between the contact and the organization with which the contact is associated. A lookup search dialog helps you search for the record associated with the one being edited. Lookup filter fields allow you to filter your lookup search by a customized list of fields in the object.

This field is equivalent to the Lookup Dialogs in the Search Layouts related list on the object detail page in the application user interface. For more information, see “Lookup Dialog Search” in the Salesforce online help.

  • 1
    Jenny B, Thanks for the clear explanation, We use Force.com Migration tool and normally deploy our meta-data from dev org -> full SB(UAT) -> production. Mentioned change has been done directly in production and wanted to deploy those changes back in the developer sandboxes and make sure all the developer orgs are up-to-date and there won't be any validation/deployment issues due to the hard-coded id value when at a release. According to your explanation I changed the Id value to the field name and my problem is solved! Thanks again. – Hasantha Sep 7 '15 at 1:07

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.