I have a custom object of "vehicles": field1: make, field2: model

The issue I'm having is how do I accomplish 1) only showing makes on Opportunity page from custom object when make is clicked and 2) only show models on Opportunity page from custom object that match the make selected?

Example data:

  • row1: make: toyota, model: camary
  • row2: make: toyota, model: highlander
  • row3: make: audi, model: a6

On Opportunity page, when user clicks make field, only toyota and audi will be presented in "dropdown"

On Opportunity page, when user clicks model field and toyota was selected for make, "camary' and "highlander" will be presented in "dropdown"

From the example data, need 1) when click make, all unique models are shown in dropdown, 2) when click model, all unique models related to make are shown in dropdown.

I originally set up Lookup Relationship for both custom fields make and model on Opportunity but the problem is when select make, the entire row from the custom object is shown "audi a6".

  • 1
    Your question is bit confusing, but I think you want to make the fields a behave as a dependent picklist but the values would be based on the custom object. Easiest option would be to use dependent picklist, otherwise you have to create a Visualforce page containing logic to make them behave as dependent.
    – Raul
    Mar 17 '17 at 20:40
  • If the dependant pick lists do not meet your needs you will have to go VF.
    – Eric
    Mar 17 '17 at 22:14
  • No code needed (view my answer below)
    – gNerb
    Mar 18 '17 at 3:35

This is pretty simple actually, we do it all the time.

Each lookup field has lookup filters that allow you to limit the results of the search based on the value of fields on the object: https://help.salesforce.com/articleView?id=fields_lookup_filters_defining.htm&type=0

We've gotten pretty creative with these and even have fields that filter based off of other lookup fields. This is your best bet without code.

Note: These won't look like picklists, they'll still look like normal object lookups but users will not be able to see models of different makes:

enter image description here


I'm using a single object called vehicle classification that has 2 record types, make and model. The idea here is that if the parent field is empty, it is a make, if the parent field is populated, it is a model of the parent make. Hope that makes sense (HA! pun).

This should be transferable to two different objects though.

  • this is crazy!!! Thanks man!! would have not thought of filters...nice! We have a custom vehicle object that contains the make/models. Do you think I can tweak this so the custom makes/models fields on the Opportunity can be used to "point" to (relationship) the makes/models on the vehicle custom object? Not sure if that makes sense, but the end result is to have the make dropdown and model dropdown on the Opportunity page to show the data from the custom vehicle object
    – user20719
    Mar 18 '17 at 18:42
  • Keep in mind this wont look like a drop-down. It will look like a lookup. It will simply not allow users to to view makes in the model field and vise versa. It will also only show models for the selected make. If you are keeping all your data in a single "Vehicle" object you can very easily adopt what I have above as I'm using a single object called "Vehicle_Classification__c". Just add a lookup on that object to create a parent field and you're done. Please remember to select the answer if it suits your needs.
    – gNerb
    Mar 18 '17 at 21:09

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.