Late loading a model isn't working with cross-model conditions

I’m having a problem when I have a model that I set to late load (not on page load). I’m setting a condition in a snippet, and then tell the model to update … and that works just fine. But other models that have relationships to the first model (such as a primary model of Lead, and a secondary related model with a condition of Task.WhoId == Lead.Id) do not update their content (they are also set to late load).

I’m making sure to call updateData, I’m waiting for Lead to load before trying to load Task, and yet I still find the Task object doesn’t work. If I switch to setting the condition manually (where I simple call Model.setCondition and use[0].Id from the Lead model) it works fine.

I’ve created a very simple example of this problem. Note that I am using RC3 of Superbank … and I’ve not tried it on any other release. This sample code uses a hard-coded Id of a Lead object - so you will need to adjust that for your own Lead objects.

Any thoughts on what I’m doing wrong?


  • Chris
<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true">   <models>
      <model id="Lead" limit="20" query="false" createrowifnonefound="false" sobject="Lead" doclone="" type="">
            <field id="Id"/>
            <field id="Name"/>
            <condition type="fieldvalue" value="" field="Id" operator="=" novaluebehavior="noquery" state="filterableon" inactive="false" name="Id" enclosevalueinquotes="true"/>
      <model id="Task" limit="20" query="false" createrowifnonefound="false" sobject="Task" doclone="" type="">
            <field id="CreatedDate"/>
            <field id="CallType"/>
            <field id="Subject"/>
            <condition type="modelmerge" value="" field="WhoId" operator="=" model="Lead" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="noquery" state="filterableon" inactive="false" name="WhoId"/>
      <basicfieldeditor showheader="true" showsavecancel="false" model="Lead" buttonposition="" mode="readonly" layout="">
            <column width="100%">
                  <section title="Section A" collapsible="no">
                        <field id="Name" valuehalign="" type=""/>
      <skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="false" model="Task" buttonposition="" mode="readonly">
            <field id="CreatedDate" valuehalign="" type=""/>
            <field id="CallType" valuehalign="" type=""/>
            <field id="Subject" valuehalign="" type=""/>
         <massactions usefirstitemasdefault="true"/>
            <view type="standard"/>
         <jsitem location="inline" name="setupId" cachelocation="false" url="">var $ = skuid.$;
$(document.body).one('pageload',function() {
    var lead = skuid.model.getModel('Lead');
    var task = skuid.model.getModel('Task');
    var leadCondition = lead.getConditionByName('Id');
    var taskCondition = task.getConditionByName('WhoId');
    lead.setCondition(leadCondition, '00Q70000011wqoiEAA', false);
//        If the following line is added, it works fine (which even loads the Id from the lead model)
//        task.setCondition(taskCondition,[0].Id, false);


Try doing a multi-model updateData() call – that should eliminate the need to do an intermediary setCondition:


This makes a difference because when both Models are being processed server-side concurrently, Skuid can re-evaluate “field from another Model” conditions because the “other Model” exists for Skuid to use it.

Ahhh…  I missed that static method!  That makes great sense, and it appears to work.  Thanks as always!

P.S. Superbank is working great in production (internal use plus SFDC community).  24 hours and no problems reported from field!

Glad to hear it!