3

I have a custom object Country with two fields Country Code which is salesforce standard name field and country name which is text field. I have a look up field to this country object. Now when user searches for a country it only matches against country code and not country name. I want both fields searchable. Sometimes users dont know country code of a country but they know country name.

2

You can't do this using the standard lookup functionality, when searching for custom objects only the "Name" field is searched. To achieve that you will need to develop your own custom search (VF component).

https://help.salesforce.com/help/doc/en/search_fields.htm#LookupSearchFields

  • Could you please give any example of custom VF component? To just get an idea. – doga Sep 14 '12 at 3:18
1

I do not think this is possible from the interface. I would recommend one of the following ideas:

  1. Switching the fields around, so that your users can search on the common field (preferred). You could then use a formula to pull in the related object's country code for use.
  2. Provide a cheat sheet for your users, that maps country codes to country names. If you are using the standard ISO codes then a link to Wikipedia might be sufficient.
  3. At worst, the users could go to a Countries tab and look there first, to find the object and its code.
  • If you populate the Hover Help bubble with the most commonly used Country codes, that could be the cheat sheet. – Jeremy Nottingham Sep 13 '12 at 19:21
  • if I use formula field and pull country code (standard name) + country name into it then will this formula field be searchable? – doga Sep 14 '12 at 3:19
  • Offhand, I am not sure. I would encourage you to try it out in a sandbox or developer org and see what happens. – Mike Chale Sep 14 '12 at 11:44
0

Use a new custom field for Country Code, and make the standard Name field a concatenation of Code and Country Name. E.g. Country_Code__c = 'US', Country_Name__c = 'United States', Name="US - United States'. People can then search on any part of the code or name. You can then use the Country Code and Country Name values separately wherever you need those things.

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.