There are two scenarios that do not render a lookup field using the DisplayTemplate. The key to reproduce is that the editor must be in full ‘edit’ mode - not read with in-line edit. The reason is that when in in-line edit, after the selection changes, the field is automatically re-rendered back in view mode and the full re-render correctly uses the display template.
When selecting a value from the built-in Skuid Lookup search popup (mag glass on right of lookup field), the value that is selected by the user always displays the “Name” field after selection even in situations where there is a Display Template on the field or even a search template. Note that this occurs even if the “Name” field isn’t displayed on the Search Popup.
When selecting a value from the drop-down list, the value from the search template is placed in to the text box.
Steps to reproduce:
- Create page using XML below
- preview any account
- click mag glass on owner field
- locate a different user and select the “chain” to pick the user
Actual Result
The value is rendered in the field using the “Name” field from the user
Expected Result
The value should be rendered using the “Alias” field which is specified in the Display Template
- locate a different user via typing and autocomplete list
Actual Result
The value is rendered using the search template
Expected Result
the value is rendered using the display template
Sample Page XML
<skuidpage unsavedchangeswarning="yes" tabtooverride="Account" showheader="true" showsidebar="true"> <models>
<model id="Account" sobject="Account" createrowifnonefound="false" query="true" limit="1">
<fields>
<field id="Name" />
<field id="CreatedDate" />
<field id="OwnerId" />
<field id="Owner.Name" />
<field id="Owner.Alias" />
</fields>
<conditions>
<condition type="param" value="id" enclosevalueinquotes="true" field="Id" operator="=" />
</conditions>
<actions />
</model>
</models>
<components>
<basicfieldeditor layout="" showheader="true" model="Account" mode="edit" showsavecancel="false" buttonposition="">
<columns>
<column width="100%">
<sections>
<section title="Basics" collapsible="no">
<fields>
<field type="" id="Name" valuehalign="" />
<field type="" id="OwnerId" valuehalign="" optionsource="" displaytemplate="{{Alias}}" searchtemplate="{{Alias}} - {{Name}}">
<searchfields>
<searchfield field="Alias" operator="contains" query="true" show="true" return="true" />
<searchfield field="Name" operator="contains" query="true" show="false" return="true" />
</searchfields>
</field>
</fields>
</section>
</sections>
</column>
</columns>
</basicfieldeditor>
</components>
<resources>
<labels />
<css />
<javascript />
</resources>
</skuidpage>