Model with a subquery condition and a subcondition migrated incorrectly to version 11.2.9

  • 1
  • Problem
  • Updated 4 weeks ago
We are seeing this in 2- to 3-year old pages, just noted after migration to version 11.2.9.


The Subcondition Logic value should be something like "1 OR 2" - not the subcondition itself. This appears to be an error in the migration from, I think, 11.1.4.

If the model is populated at page-load, the subquery is handled as desired. However, if the query is deferred and run by a javascript model.updateData() call, the subcondition is not included in the SOQL as shown by skuid.$M.("MyModel").soql).
Photo of Mike Dwyer

Mike Dwyer

  • 3,390 Points 3k badge 2x thumb

Posted 4 weeks ago

  • 1
Photo of Mike Dwyer

Mike Dwyer

  • 3,390 Points 3k badge 2x thumb
Here's a sample page, with console messages displaying the change to the SOQL:

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true">
    <models>
        <model id="Users" limit="20" query="false" createrowifnonefound="false" datasource="salesforce" sobject="User">
            <fields>
                <field id="Name"/>
                <field id="LastLoginDate"/>
            </fields>
            <conditions>
                <condition type="join" value="" field="Id" operator="in" enclosevalueinquotes="true" joinobject="ApexClass" joinfield="CreatedById" fieldtargetobjects="User" logic="CreatedDate &lt; LAST_N_YEARS:3"/>
            </conditions>
            <actions>
                <action>
                    <actions>
                        <action type="custom" snippet="onRequery"/>
                    </actions>
                    <events>
                        <event>models.loaded</event>
                    </events>
                </action>
            </actions>
        </model>
    </models>
    <components>
        <skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" hideheader="false" hidefooter="false" pagesize="10" alwaysresetpagination="false" createrecords="true" model="Users" buttonposition="" mode="read" allowcolumnreordering="true" responsive="true" uniqueid="sk-28ss-1173">
            <fields>
                <field id="Name" hideable="true" uniqueid="fi-28s--1212"/>
                <field id="LastLoginDate" hideable="true" uniqueid="fi-28s--1213"/>
            </fields>
            <rowactions>
                <action type="edit"/>
                <action type="delete"/>
            </rowactions>
            <massactions usefirstitemasdefault="true">
                <action type="massupdate"/>
                <action type="massdelete"/>
            </massactions>
            <views>
                <view type="standard"/>
            </views>
            <actions defaultlabel="Global Actions" defaulticon="sk-icon-magic" usefirstitemasdefault="true">
                <action type="multi" icon="sk-icon-case" label="Query Users">
                    <actions>
                        <action type="requeryModel" model="Users" behavior="standard"/>
                    </actions>
                </action>
            </actions>
        </skootable>
    </components>
    <resources>
        <labels/>
        <javascript>
            <jsitem location="inline" name="onPageLoad" cachelocation="false" url="">(function(skuid){
var $ = skuid.$;
$(document.body).one('pageload',function()
{
        console.log("Query on page load:")
        console.log(skuid.model.getModel("Users").soql);
    }
    );
})(skuid);</jsitem>
            <jsitem location="inlinesnippet" name="onRequery" cachelocation="false">console.log("on re-query:")
console.log(skuid.model.getModel("Users").soql);</jsitem>
        </javascript>
        <css/>
        <actionsequences uniqueid="sk-28s--1206"/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>

You may need to play with the subcondition itself. The subquery as I defined it will list our earliest Apex Class authors. When the SOQL "breaks," it lists all our Apex Class authors. But you will see the SOQL change regardless of the user records actually retrieved, or not.