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

  • 1
  • Problem
  • Updated 2 months ago
  • In Progress
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, Champion

  • 3,790 Points 3k badge 2x thumb

Posted 3 months ago

  • 1
Photo of Mike Dwyer

Mike Dwyer, Champion

  • 3,790 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.

Photo of Stephen Sells

Stephen Sells, Official Rep

  • 17,264 Points 10k badge 2x thumb
Hey Mike! I was wondering if you'd be able to grant Skuid login to be able to see what you're seeing here. When I copy the XML onto the page in 11.2.11, I'm not seeing anything strange in the console. I see this:

I don't believe I'm fully understanding the repro. With clearer steps to repro or perhaps more insight into what you're seeing, I might be able to be useful for a change.
Let me know.
Photo of Mike Dwyer

Mike Dwyer, Champion

  • 3,790 Points 3k badge 2x thumb
I see a couple of differences on your console.

1st is the "on re-query" display happening before page load. I don't think I've seen a model Action "when Model requeried" triggered on the initial load. It's not happening for me.

Secondly, none of your SOQL statements include the subquery condition "...xClass WHERE ((CREATEDDATE<LAST_N_YEARS:3)))) LIM... (Line 9 in the xml).

I loaded the xml from the post above into a new page today and I get this:



This is what that subcondition looks like in the composer:



As to access, I'm not certain exactly how to do that, or more importantly, if I have the authority to do so given our confidentiality constraints. The Admin I need to talk to, unfortunately, is out until Dec 5.
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,888 Points 10k badge 2x thumb
Mike,

I think you may be creating your sub condition incorrectly.  The field 'Subcondition Logic' is used to define how to apply the sub conditions.  It would normally look like this->  1 OR 2

I modified your page slightly and added the sub query condition.  Here is what i see:



Here is the modified page.  It does show the same query applied on page load and after clicking the query button.

<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">
<conditions>
    <condition type="fieldvalue" value="LAST_N_YEARS:3" enclosevalueinquotes="false" field="CreatedDate"/>
</conditions>
</condition>
            </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>

Thanks,

Bill
Photo of Mike Dwyer

Mike Dwyer, Champion

  • 3,790 Points 3k badge 2x thumb
Thanks, Bill. But that was the point of the post, that the subcondition logic moved on an upgrade, and the page quit working correctly.
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,888 Points 10k badge 2x thumb
Mike,

My mistake!  I understand what is happening.

I think Skuid needs to do the following to reproduce this issue:
  1. Create a new developer org.
  2. Install an older version of Skuid (11.2.4).
  3. Install your sample page.  Verify that it works.
  4. Update Skuid to 11.2.9.
  5. View your page and see if it ran into the same issue with migrating the sub-query condition.
Thanks,

Bill
Photo of Mike Dwyer

Mike Dwyer, Champion

  • 3,790 Points 3k badge 2x thumb
Yes. Agreed! The post was also submitted as an FYI for anyone else who might encounter the same symptoms.