cross model linked conditions

Tami,

Here are two snippets, modified from Pat’s. The first I use to initialize the date range on the primary model on pageload. The second I use to link the conditions each time the primary model is queried. You need a conditions called “StartDate” and “EndDate” on each model that you want to link.

<jsitem location="inline" name="initializeDateConditions" cachelocation="false" url="">(function(skuid){
var $ = skuid&#46;$;
$(document&#46;body)&#46;one('pageload',function(){
var dateRangeModel = skuid&#46;$M('Cases'),
    startDateCondition = dateRangeModel&#46;getConditionByName('StartDate'),
    endDateCondition =  dateRangeModel&#46;getConditionByName('EndDate'),
    startDate = new Date(),
    endDate = new Date(),
    startDateOffset = -15,
    endDateOffset = -1;
    
    startDate&#46;setDate(startDate&#46;getDate() + startDateOffset);
        endDate&#46;setDate(endDate&#46;getDate() + endDateOffset);
    
        var startConditionValue = skuid&#46;time&#46;getSFDateTime(startDate),
            endConditionValue = skuid&#46;time&#46;getSFDateTime(endDate);
        
        dateRangeModel&#46;setCondition(startDateCondition, startConditionValue);
        dateRangeModel&#46;setCondition(endDateCondition, endConditionValue);
    
        dateRangeModel&#46;updateData();
    
});
})(skuid);</jsitem>
      <jsitem location="inlinesnippet" name="linkConditions" cachelocation="false">var $ = skuid&#46;$;
var startValue = skuid&#46;$M('Cases')&#46;getConditionByName('StartDate')&#46;value,
    endValue = skuid&#46;$M('Cases')&#46;getConditionByName('EndDate')&#46;value;
var targetModels = [];
targetModels&#46;push(skuid&#46;$M('numberOfSchedulingLeads'));
$&#46;each(targetModels, function(){
   this&#46;setCondition(this&#46;getConditionByName('StartDate'), startValue);
   this&#46;setCondition(this&#46;getConditionByName('EndDate'), endValue);
});
</jsitem>

After you run the linking script, you’ll need to query the linked (drawer) model.