Lookup search template behavior for standard vs custom relationship fields

edited March 2, 2017 in Questions
Hi,

We have a opportunity creation wizard and we use couple of lookup fields on Account object, out of which, one is standard AccountId field and other is a custom field. 

We have an external id field (Account Search Helper) on Account which we are trying to leverage to search for data. Now, when i have search as well as display template as Account Search Helper field, even though results are returned, the data for standard account field is not returned. when i change search and display template to Name, then data is displayed. So here i am also not sure if our external id field works in fetching results or not. This problem occurs for only standard account field and not custom one.

here is the code:
<skuidpage unsavedchangeswarning="" showsidebar="false" showheader="false" tabtooverride="Opportunity" theme="Modern" personalizationmode="server">   <models>
      <model id="RecordType" limit="1" query="true" createrowifnonefound="false" sobject="RecordType" doclone="" type="">
         <fields/>
         <conditions>
            <condition type="fieldvalue" value="Target" enclosevalueinquotes="true" field="DeveloperName"/>
            <condition type="fieldvalue" value="Opportunity" enclosevalueinquotes="true" field="SobjectType"/>
         </conditions>
         <actions/>
      </model>
      <model id="Opportunity" limit="1" query="false" createrowifnonefound="true" sobject="Opportunity" type="" adapter="">
         <fields>
            <field id="AccountId"/>
            <field id="Account.Name"/>
            <field id="Name"/>
            <field id="DBG_Broker__c"/>
            <field id="DBG_Broker__r.Name"/>
            <field id="CloseDate"/>
            <field id="Amount"/>
            <field id="StageName"/>
            <field id="DBG_Broker__r.Account_Search_Helper__c"/>
            <field id="Account.Account_Search_Helper__c"/>
         </fields>
         <conditions>
            <condition type="modelmerge" value="" field="RecordTypeId" operator="=" model="RecordType" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="deactivate"/>
            <condition type="fieldvalue" value="Target" enclosevalueinquotes="true" field="StageName" state=""/>
            <condition type="fieldvalue" value="TODAY" enclosevalueinquotes="false" field="CloseDate"/>
         </conditions>
         <actions/>
      </model>
   </models>
   <components>
      <panelset type="standard" cssclass="mask" scroll="" uniqueid="sk-sNpWI-153">
         <panels>
            <panel>
               <components>
                  <wizard deferstepcontentsrendering="true" cssclass="" uniqueid="targetWizard">
                     <steps>
                        <step stepid="step1" steplabel="Create Target">
                           <components>
                              <pagetitle model="Opportunity" uniqueid="sk-sNpWI-154">
                                 <actions>
                                    <action type="multi" label="Save &amp; Finish" icon="fa-check">
                                       <actions>
                                          <action type="save" rollbackonanyerror="true">
                                             <models>
                                                <model>Opportunity</model>
                                                <model>TargetCampaignInfluence</model>
                                             </models>
                                          </action>
                                       </actions>
                                    </action>
                                 </actions>
                              </pagetitle>
                              <basicfieldeditor showheader="true" showsavecancel="false" model="Opportunity" buttonposition="" mode="edit" layout="" uniqueid="sk-sNpWI-155">
                                 <columns layoutmode="fixed">
                                    <column width="50%">
                                       <sections>
                                          <section title="General Information" collapsible="no">
                                             <fields>
                                                <columns layoutmode="fixed">
                                                   <column width="100%">
                                                      <sections>
                                                         <section title="New Section" collapsible="no" showheader="false">
                                                            <fields>
                                                               <field id="Name" valuehalign="" type="">
                                                                  <label>Target Name</label>
                                                               </field>
                                                               <field id="AccountId" showhelp="true" valuehalign="" type="" required="true" optionsource="" displaytemplate="{{Account_Search_Helper__c}}" searchtemplate="{{Account_Search_Helper__c}}" tokenizesearch="true">
                                                                  <label>Client</label>
                                                                  <filters>
                                                                     <filter type="fieldvalue" operator="=" enclosevalueinquotes="true" field="RecordType.DeveloperName" value="Account"/>
                                                                  </filters>
                                                                  <searchfields usesosl="true" soslfields="Sidebar Fields"/>
                                                                  <renderconditions logictype="and" onhidedatabehavior="keep"/>
                                                                  <enableconditions logictype="and"/>
                                                               </field>
                                                               <field id="DBG_Broker__c" showhelp="true" valuehalign="" type="" required="true" optionsource="" displaytemplate="{{Account_Search_Helper__c}}" searchtemplate="{{Account_Search_Helper__c}}" tokenizesearch="true">
                                                                  <label>Producer</label>
                                                                  <filters>
                                                                     <filter type="fieldvalue" operator="=" enclosevalueinquotes="true" field="RecordType.DeveloperName" value="Broker"/>
                                                                  </filters>
                                                                  <searchfields usesosl="true" soslfields="Sidebar Fields"/>
                                                                  <renderconditions logictype="and" onhidedatabehavior="keep"/>
                                                                  <enableconditions logictype="and"/>
                                                               </field>
                                                            </fields>
                                                         </section>
                                                      </sections>
                                                   </column>
                                                </columns>
                                             </fields>
                                          </section>
                                       </sections>
                                    </column>
                                    <column width="50%">
                                       <sections>
                                          <section title="Target Detail" collapsible="no">
                                             <fields>
                                                <columns>
                                                   <column width="100%">
                                                      <sections>
                                                         <section title="New Section" collapsible="no" showheader="false">
                                                            <fields>
                                                               <field id="Amount" showhelp="true" decimalplaces="" valuehalign="" type=""/>
                                                               <field id="CloseDate" showhelp="true" valuehalign="" type=""/>
                                                            </fields>
                                                         </section>
                                                      </sections>
                                                   </column>
                                                </columns>
                                             </fields>
                                          </section>
                                       </sections>
                                    </column>
                                 </columns>
                              </basicfieldeditor>
                           </components>
                           <actions/>
                        </step>
                     </steps>
                  </wizard>
               </components>
            </panel>
         </panels>
      </panelset>
   </components>
   <resources>
      <labels/>
      <javascript/>
      <css>
         <cssitem location="inline" name="styles" cachelocation="false">.mask {
    width: 1024px;
}</cssitem>
         <cssitem location="inline" name="productSectionWidth" cachelocation="false">#productSectionId {
    width:50%;
}</cssitem>
      </css>
   </resources>
   <styles>
      <styleitem type="background" bgtype="none"/>
   </styles>
</skuidpage>


Some pointers:
tokenized search, SOSL search are enabled. For search fields, we are using Sidebar option from dropdown.

is there an issue the way the search works in case of standard relationship fields?

Comments

  • Emily DavisEmily Davis ✭✭✭✭
    edited March 2, 2017
    Hi, Sunny,
    I tried to reproduce your issue and wasn't able to reproduce any kind of problem. When you say "the data for standard account field is not returned", are you saying that, when typing a value into the autocomplete field, the external Id field values do not show in the dropdown of lookup results (as in, an empty dropdown)? Or does no dropdown display at all? I used your xml and made a couple of changes:
    1. Changed the search template and display template to use our own custom external id field.
    2. Changed the lookup filter on the AccountId field to use a record type DeveloperName from our own org.
    Here is what I got when trying to search on the external Id field:

    image


    I would check the permissions on your external Id field. Is it possible that your users aren't given permission to view the external Id field?
    Emily
  • edited November 25, 2015
    Thanks Emily. when i have display and search template to be external id field, even though data is returned (as per debug log), the dropdown doesn't show results. and if i add name field in template, then i can see data in dropdown. however, if use combination of name and external id field in templates, then only name is displayed in dropdown. 

    when you search for 123 in example shown, is this displaying the external id values in dropdown?
  • Emily DavisEmily Davis ✭✭✭✭
    edited December 21, 2016
    Sunny,
    Yes, those values in the dropdown are external id values. So, if I use the template {{Name}} ({{External_Id_Test__c}}) for both the Display Template and the Search Template, this is what I get:

    image

    Have you checked if you are able to view the external id field at all within the Skuid page? For example, if you show a list of Account records in a table with a column on the external id field, can you see the values there? Have you checked if your page viewers have access to the ext id field through Salesforce permissions settings?
  • edited November 29, 2015
    Have you checked if you are able to view the external id field at all within the Skuid page? For example, if you show a list of Account records in a table with a column on the external id field, can you see the values there? 
    No. I don't see results in case of Account recordtype. For Broker recordtype, it works fine. Debug logs shows results from SOQL but not on ui.

    Have you checked if your page viewers have access to the ext id field through Salesforce permissions settings?
    Same field is displayed for Broker recordtype field. Same field is included for both account and broker fields. 

    Let me know if you need access to our org and investigate on this issue.

    Thanks.
  • Emily DavisEmily Davis ✭✭✭✭
    edited December 21, 2016
    Hi, Sunny,
    If you don't mind giving Skuid login access to your org, that would be fantastic! Then I can go in and take a look.
    Thanks!
    Emily
  • edited November 30, 2015
    Hi Emily,

    Login access provided for 3 days. Page testPage
  • Emily DavisEmily Davis ✭✭✭✭
    edited December 21, 2016
    Sunny,
    I think you uncovered a bug in Skuid. It was tough to find, but it looks like the issue is caused by the external id field (Account_Search_Helper__c) having the word "Account" (e.g. the same name as the field related to the Opportunity) in the field name. We have a bug fix planned to go out in our next patch, but until then, your workaround would be to change the name of the external id field to NOT include the object name (e.g. "Account") in the field name. I hope this is a feasible workaround for the time being.
    Let me know if that makes sense.
    Emily
  • edited December 2, 2015
    Thanks Emily for your response. Another thing. We have another child object of Account where field api name is DBG_Account__c, for that it works. Is it that wherever the relationship name is Account, this will not work and we have to wait for bug fix?
  • Emily DavisEmily Davis ✭✭✭✭
    edited December 21, 2016
    Sure! Actually, it looks like the issue occurs when the field api name begins with "Account". It looks like somehow Skuid was cutting off "Account" from the beginning of "Account_Search_Helper__c" when performing the search. So, for objects where the relationship namebegins with "Account", you will have to either change the relationship name or wait for the bug fix.
  • Karen WaldschmittKaren Waldschmitt 🛠️ 
    edited March 2, 2017
    Hi~

    This issue has been resolved in Update 7 and is available now from the Skuid Releases page: http://www.skuidify.com/skuidreleases.

    Thanks!
    Karen
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!