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.$;
$(document.body).one('pageload',function(){
var dateRangeModel = skuid.$M('Cases'),
startDateCondition = dateRangeModel.getConditionByName('StartDate'),
endDateCondition = dateRangeModel.getConditionByName('EndDate'),
startDate = new Date(),
endDate = new Date(),
startDateOffset = -15,
endDateOffset = -1;
startDate.setDate(startDate.getDate() + startDateOffset);
endDate.setDate(endDate.getDate() + endDateOffset);
var startConditionValue = skuid.time.getSFDateTime(startDate),
endConditionValue = skuid.time.getSFDateTime(endDate);
dateRangeModel.setCondition(startDateCondition, startConditionValue);
dateRangeModel.setCondition(endDateCondition, endConditionValue);
dateRangeModel.updateData();
});
})(skuid);</jsitem>
<jsitem location="inlinesnippet" name="linkConditions" cachelocation="false">var $ = skuid.$;
var startValue = skuid.$M('Cases').getConditionByName('StartDate').value,
endValue = skuid.$M('Cases').getConditionByName('EndDate').value;
var targetModels = [];
targetModels.push(skuid.$M('numberOfSchedulingLeads'));
$.each(targetModels, function(){
this.setCondition(this.getConditionByName('StartDate'), startValue);
this.setCondition(this.getConditionByName('EndDate'), endValue);
});
</jsitem>
After you run the linking script, you’ll need to query the linked (drawer) model.