Lookup field not rendered using Display Template after selection changes

  • 1
  • Problem
  • Updated 4 years ago
  • Solved
  • (Edited)
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.

1) 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.

2) 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:
1) Create page using XML below
2) preview any account
3) click mag glass on owner field
4) 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

5) 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>
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Hello -

With the fix in 6.8.8 for https://community.skuidify.com/skuid/topics/reference-field-selected-from-lookup-popup-not-rendering..., the first part of this (picking from search lookup) has been addressed (using render() instead of val(field.name)).

Any chance a similar solution for the 2nd part of this one (picking from auto-complete) can be implemented?  Currently, the behavior is inconsistent depending on which "selection" method the user uses.

Thanks!
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
This has been fixed in the dev and patch orgs.  A fix should be available in the next patch release.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Thanks Ben!
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Just tested with 6.8.10 and confirmed this has been resolved.  Thank you!
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
I think the language in the release notes is backwards (Search Template vs. Display Template):

When a user chooses an option for a Reference field, the field's Search Template is now correctly displayed, rather than the Display Template.

Should be

When a user chooses an option for a Reference field, the field's Display Template is now correctly displayed, rather than the Search Template.