2

Say I have a one-to-many lookup relationship between 'Parts' and 'PartsCategory' objects. Something like say the following example records:

Part, Price, Brand, Model, CategoryCode:
Front fender, $40.40, Mercedes, A-class, 10.23.4
Rim, $80.00, Chrysler, Voyager, 23.10.4

Category, Location, Manager, Code:
Plastics/Protection, Warehouse C, John Doe, 10.23.4
Wheels, Warehouse F, Jane Doe, 23.10.4

If I create a lookup between the two the user will be presented with a picklist of PartsCategory that will fill with the SF generated, to the user meaningless, IDs. I would like to change this to Category(Plastics/Protection, Wheels.... etc.). What's the best way of doing this. I'm aware and have already create custom formula fields that display the Category and Location fields but how would i create/change the picklist so that the user can search/select on Category name instead of a meaningless Category ID ?

I have a similar question with picklists, it's important to us to separate name/value pairs to be able to interact with other systems with existing IDs. Also, having hardcoded strings instead of name/value pairs like with picklists seems a bad idea to me although from the research I've done there is not a clear and simple way how to handle these problems. To summarize:

  1. What's the best way to implement name/value pairs for picklists? (custom object with a lookup relationship brings me to the next question)

  2. What's the best way to customize the field on wich a lookup relationships searches (so not on SF name field but say the CategoryName field)

  • Where are you trying to implement? Visualforce? – Adrian Larson May 10 '16 at 15:33
  • 1
    Don't page layouts and lookup fields give you this out of the box? While Salesforce stores the ID in the lookup field value, when you click on the magnifying glass to perform a lookup, you can search by name. – mkorman May 10 '16 at 15:42
  • At the moment, i'm just clicking it together in the UI (Customize->Object->Add customfield). The consideration being that it will be easier to maintain for the admins(company doesn't wan't too spend money on a permanent IT guy for maintaining SF). However, as i am more a programmer then an admin i wouldn't mind a VisualForce or Apex solution. @mkorman: The name field is just an SF generated ID at the moment so it doesn't mean a thing for the user. I did find an option for what SF call 'enhaced lookups' but they only work for standard objects. I could import my IDs to the name field. – Jaap V. May 10 '16 at 15:43
  • @JaapV. then perhaps you need to edit the metadata for the "Category" object and change its "Name" to be the user-friendly label. If this can be done with point-and-click I would avoid the VF solution (and I am more of a programmer too!) – mkorman May 10 '16 at 15:51
  • What prevents you to have Name in SF Category object as actual category name, and not the code? And to have Code field as an external ID – o-lexi May 10 '16 at 16:51
0

Solution: Just use the name field that SF provides for you by default. Like Oleksiy notes, there is no reason not to use the field.

| improve this answer | |

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.