Lookup search SOQL error after Brooklyn update

Maybe I am missing something obvious here, but I have a new error when searching within a lookup field after upgrading to the latest Brooklyn release (9.5.5) in a sandbox. Production is still on version 8.13 (I know, I’m very behind the times and have been scolded) and is not having this error.

Lookup is to the Contact object, which is the parent to the custom object record being entered. When I start typing something in the auto-complete lookup field, I get the following SOQL error:

An error occurred while attempting to perform the following SOQL query: SELECT Name,FirstName,LastName,Birthdate,Current_Age__c,Sex__c,Ethnicity__c,Primary_Language__c,Id FROM Contact WHERE ((RecordType.DeveloperName != ‘Staff’))AND(((Name LIKE ‘%test%’)OR(FirstName LIKE ‘%test%’)OR(LastName LIKE ‘%test%’)OR(Current_Age__c LIKE ‘%test%’))) ORDER BY Name LIMIT 51 Error:like operator only valid on string field

Current_Age__c is a numeric formula field. I am not sure why the SOQL would be attempting to search on this field. It does not appear to be doing so in production. The XML for this field is below. The XML is the same in sandbox and production and was generated from the page builder UI (and not manually modified).

Thank you for any help with this!

<field id="Contact__c" showhelp="true" valuehalign="" type="" optionsource="" displaytemplate="{{Name}} • {{#Birthdate}}DOB {{Birthdate}}{{/Birthdate}}{{^Birthdate}}[unknown DOB]{{/Birthdate}}" searchtemplate="{{Name}} • {{#Birthdate}}DOB {{Birthdate}}{{/Birthdate}}{{^Birthdate}}[unknown DOB]{{/Birthdate}}{{#Current_Age__c}} • Age {{Current_Age__c}}{{/Current_Age__c}} • {{#Sex__c}}{{Sex__c}}{{/Sex__c}}{{^Sex__c}}[unknown gender]{{/Sex__c}} • {{#Ethnicity__c}}{{Ethnicity__c}}{{/Ethnicity__c}}{{^Ethnicity__c}}[unknown race/ethnicity]{{/Ethnicity__c}}">    <label>Look up client/contact</label>
        <searchfield query="true" return="true" show="false" field="Name" operator="contains"/>
        <searchfield query="true" return="true" show="true" field="FirstName" operator="contains"/>
        <searchfield query="true" return="true" show="true" field="LastName" operator="contains"/>
        <searchfield query="true" return="true" show="true" field="Birthdate"/>
        <searchfield query="true" return="true" show="true" field="Current_Age__c"/>
        <searchfield query="false" return="true" show="true" field="Sex__c" operator="contains"/>
        <searchfield query="false" return="true" show="true" field="Ethnicity__c" operator="contains"/>
        <searchfield query="false" return="true" show="true" field="Primary_Language__c" operator="contains"/>
        <filter type="fieldvalue" operator="!=" enclosevalueinquotes="true" field="RecordType.DeveloperName" value="Staff"/>

And Thorough,

Can you try adding the Contact__c.Current_Age__c field to your main model (I’m guessing you’ll need to look up the Current_Age field though the Contact relationship). I think there was a change made and now Skuid tries to search through more fields than it did before (theoretically to return better results), and it only won’t search through a field if it knows it’s a non-searchable type (such as a number). In this case, I think Skuid can’t tell the metadata of Current_Age, so it tries to search it. 

Thank you, Amy.  This worked!  And sorry, took me a while to get back to this.  I did not need to add the other Contact fields to the main model for it to work though.  Contact Name, FirstName, LastName, and Birthdate were already in the model, but I did not need to add Sex__c, Ethnicity__c, or Primary_Language__c – these three are picklist fields – nor did I need to add Contact RecordType.

So, I guess my question is, is this just because Current_Age__c is a formula field?  So, Skuid is able to figure out the data types of the non-formula fields in a lookup without them being added to the main model, but formula fields need to be added?

Not exactly. You should actually just go ahead and add all fields on a lookup to the main model. We made some changes to improve page performance where we don’t pull in as much metadata as we did before, including the metadata of search fields. That means that if the search fields aren’t included in the main model there’s no metadata for them and Skuid assumes you can search through them. However, if you include the fields in the model then we can access their metadata and know if we should search through them or not. We’ll be adjusting this behavior in the future, but for now adding the fields to the model is the best thing to do.

Hello Community,

This issue may have been related to a bug that has now been resolved in the Brooklyn (10.0.4) Maintenance Release and the Brooklyn (9.5.11) Maintenance Release which are now available from the Skuid Releases page

As a reminder, Salesforce does NOT allow reverting back to prior versions of managed packages. Skuid always recommends installing new versions in a non-business critical sandbox environment to test all mission critical functionality before installing into a production environment. We also recommend that you update out of date themes when you upgrade.