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.
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).
I do not think this is possible from the interface. I would recommend one of the following ideas:
- 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.
- 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.
- At worst, the users could go to a Countries tab and look there first, to find the object and its code.
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.