cross model linked conditions

Hi Matt,

I’m trying to use same principle to get this idea working, and wondering if you think it could work.

I have some sort of “Dashboard” built on Skuid, which contains 15+ models

And i want to Be able to input 1 Date Range manually (prob 2 ui only date fields , 1 for startdate , 1 for enddate- as cannot use automatically generated filters)

and once date range is inputted for it to affect all 15 models with same condition name

Any ideas?

This would certainly work. As Matt has done, you could name all the filters in each model with the same names so that you could create a snippet to loop through the models in order to update each of their conditions and then query them after which.

If you want to update every model in your page with your ui only fields, then you could loop through them using skuid.model.list(). If not, create an array of the model id’s to loop through in this way.

var models = [‘model1’,‘model2’,…],

$.each(models, function(m,modelid)({
   model = skuid.$M(‘modelid’)
   // update model conditions

I’d just put a pagetitle with an ‘apply’ button next to your date range fields, and have the button run a snippet that goes something like this:

var $ = skuid&#46;$; $&#46;blockUI(); var row = skuid&#46;$M('MyUiOnlyModel')&#46;getFirstRow(), startValue = row&#46;StartDate &nbsp; &nbsp; endValue = row&#46;EndDate; var targetModels = skuid&#46;model&#46;list(); <br /> &#47;&#47; If you don't want to apply the condition to all of your models, &#47;&#47; you can list them manually in the targetModels array like so: &#47;&#47; var targetModels = [skuid&#46;$M('Model1'),skuid&#46;$M('Model2')]; <br />$&#46;each(targetModels, function(){<br />&nbsp; &nbsp;this&#46;setCondition(this&#46;getConditionByName('StartDate'), startValue);<br />&nbsp; &nbsp;this&#46;setCondition(this&#46;getConditionByName('EndDate'), endValue);<br />}); $&#46;when(skuid&#46;model&#46;updateData(targetModels))&#46;then(function(){ $&#46;unblockUI(); });

HI Matt & Pat,

Thank you and  Sorry was a bit busy and was only able to test this today.

I created a model named MyUiOnlyModel , and 2 Ui-only fields in it, named StartDate and EndDate
+ create 2 condition (filterable off) in 1 other model to test , condition are named StartDate and EndDate

Apply button has 1 Action: Run the Snippet above

When i try it, i get this error in console :  Uncaught Model ‘MyUiOnlyModel’ has unsaved changes. To update this model’s data, you must first save or cancel the changes.

On the model named ‘MyUiOnlyModel’, I unchecked the option to Prevent users from leaving page if this Model has unsaved change, but Still having same error

The UI is stuck and cannot test properly because of it.

Any Ideas?

Thank you

The “MyUiOnlyModel” must be set to query as well. You’ll have to cancel the changes prior to query but after setting conditions.

Thank you , been trying, but nothing works. i guess not knowledgeable enough in JS to modify Matt’s Script on my own :frowning:

In case any of you have a similar script you are already using please share, so i can try to understand it.

var $ = skuid.$;<br>
$.blockUI(); var row = skuid.$M('MyUiOnlyModel').getFirstRow(), startValue = row.StartDate &nbsp; &nbsp; endValue = row.EndDate; var targetModels = skuid.model.list(); <br> // If you don't want to apply the condition to all of your models, // you can list them manually in the targetModels array like so: // var targetModels = [skuid.$M('Model1'),skuid.$M('Model2')]; <br>$.each(targetModels, function(){<br>&nbsp; &nbsp;this.setCondition(this.getConditionByName('StartDate'), startValue);<br>&nbsp; &nbsp;this.setCondition(this.getConditionByName('EndDate'), endValue);<br>}); $.when(skuid.model.updateData(targetModels)).then(function(){ $.unblockUI(); });

Hi All,

I’ve also been trying to edit this snippet, to no avail. My use case:

  • Two different objects, both with a multipicklist that uses a global picklist
  • If I filter object A, I want object B to also filter

My code is below, where the two models in Skuid are named ‘Projects’ and ‘Focus_Area_Grouping’. The model is named "Focus_Area_Grouping’ in both objects.

var $ = skuid.$,    Projects = skuid.$M(‘Projects’),
    Focus_Area_Grouping = skuid.$M(‘Focus_Area_Grouping’);
    $.each(Projects.conditions, function(i,condition){
        var agConditionName =,
            Focus_Area_Groupings__c = Focus_Area_Grouping.getConditionByName(Focus_Area_Groupings__c);

        if(condition.inactive) {
        } else {


Additionally, I also tried this:
var $ = skuid.$, Projects = skuid.$M(‘Projects’),Focus_Area_Grouping = skuid.$M(‘Focus_Area_Grouping’);

$.each(Projects.conditions, function(i,condition){

var agConditionName =,
basicCondition = Focus_Area_Grouping.getConditionByName(agConditionName);
if(!agConditionName) {
return true;
} else if(condition.inactive) {
} else {

Any help welcome!

If you’re only dealing with one condition, you don’t need the ‘$.each’.

Try something like this…

var $ = skuid.$, &nbsp; &nbsp; Projects = skuid.$M('Projects'),<br>&nbsp; &nbsp; Focus_Area_Grouping = skuid.$M('Focus_Area_Grouping');<br>&nbsp; &nbsp;&nbsp;<br>var projectsCondition = Projects.getConditionByName('Focus_Area_Grouping'),<br>&nbsp; &nbsp; focusAreaGroupingCondition = Focus_Area_Grouping.getConditionByName('Focus_Area_Grouping');<br>&nbsp; &nbsp; if(projectsCondition.inactive) {<br>&nbsp; &nbsp;Focus_Area_Grouping.deactivateCondition(focusAreaGroupingCondition);<br>} else {<br>&nbsp; &nbsp;Focus_Area_Grouping.setCondition(focusAreaGroupingCondition, projectsCondition.value);<br>}