I am trying to set the Search Fields for a Reference field based on a Model and am getting some very buggy behavior. I have Skuid 7.36.1 installed but had the same problem with 7.31.
The problem arises when I try to search on fields that are references themselves. So In the case below if I have an Account field and want to search on the name of the Account and the name of the Account Owner (eg Owner.Name) it causes a problem.
If I open the search Popup and search for a value and then look at the model in the console it shows the SOQL such as:
SELECT Name,OwnerId,Owner.Name,Id FROM Account WHERE (((Name LIKE ‘%test%’))) LIMIT 21
when it should be more like:
SELECT Name,OwnerId,Owner.Name,Id FROM Account WHERE (((Owner.Name LIKE ‘%test%’) or (Name LIKE ‘%test%’)))
If I just set the Search Fields to Owner it uses SOQL like:
SELECT Name,OwnerId,Owner.Name,Id FROM Account WHERE (((Owner.Name LIKE ‘%test%’)))
But if I have both Account Name and Owner as Search Fields it only searches the Account Name.
I have also found different behavior when I use the Search Popup (by clicking the magnifying glass in the reference field) vs when I type directly in the field to search, but am having trouble reproducing it in a simple test page.
Any way to fix this problem?
Below is XML that reproduces the problem.
<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true">
<models>
<model id="Contact" limit="20" query="true" createrowifnonefound="false" adapter="" type="" sobject="Contact">
<fields>
<field id="FirstName"/>
<field id="LastName"/>
<field id="AccountId"/>
<field id="Account.Name"/>
</fields>
<conditions>
<condition type="param" value="id" field="Id" operator="=" enclosevalueinquotes="true" novaluebehavior=""/>
</conditions>
<actions/>
</model>
<model id="Account" limit="20" query="true" createrowifnonefound="false" adapter="" type="" sobject="Account">
<fields>
<field id="Name"/>
<field id="OwnerId"/>
<field id="Owner.Name"/>
</fields>
<conditions/>
<actions/>
</model>
</models>
<components>
<basicfieldeditor showheader="true" showsavecancel="true" showerrorsinline="true" model="Contact" buttonposition="" uniqueid="sk-1pZ6i7-352" mode="edit">
<columns>
<column width="50%">
<sections>
<section title="Section A" collapsible="no">
<fields>
<field id="AccountId" valuehalign="" type="" optionsource="model" optionmodel="Account" displaytemplate="{{Name}} - {{Owner.Name}}" searchtemplate="{{Name}} - {{Owner.Name}}">
<searchfields>
<searchfield query="true" return="true" show="true" field="OwnerId" operator="="/>
<searchfield query="true" return="true" show="false" field="Owner.Name"/>
<searchfield query="true" return="true" show="true" field="Name" operator="contains"/>
</searchfields>
</field>
<field id="LastName"/>
<field id="FirstName"/>
</fields>
</section>
</sections>
</column>
<column width="50%">
<sections>
<section title="Section B">
<fields/>
</section>
</sections>
</column>
</columns>
</basicfieldeditor>
</components>
<resources>
<labels/>
<javascript/>
<css/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</skuidpage>