Rendering a lookup field as a picklist and have it become the default value

  • 1
  • Question
  • Updated 4 years ago
  • Answered
I am trying to render a lookup field and have it render as a picklist.  I am getting the record I want returned but I have to click on the arrow for the picklist to select it, even though it is the only record returned.  Is there a way for the record to automatically become the selected default value?
Photo of Jeffrey Lawler

Jeffrey Lawler

  • 1,454 Points 1k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
If you mark the field as Required, then the first record returned will be automatically selected.
Photo of Jeffrey Lawler

Jeffrey Lawler

  • 1,454 Points 1k badge 2x thumb

It looks like I am getting two records returned with one being blank.  Not sure what that is happening.  Is there any way to strip the blank out so the record with the data becomes the default value?
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Add a condition to the model in which these records come from to not allow blank values for the lookup field.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
You could also add a condition on the reference field filter that does not allow blanks.  (Though that may be what Pat is referring to using different language)
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
yup. same deal. 

Photo of Jeffrey Lawler

Jeffrey Lawler

  • 1,454 Points 1k badge 2x thumb
Thank you gentlemen.   I did get it working and I appreciate your assistance.