Jonathan, I think a combination of Model Actions, Conditional Rendering, and Ui-Only Fields will get you where you’d like to be here.
I would start by creating a “Ui Only Model” on your page, basically just create a Model called something like “UiOnly” on the Account object, set to “Create Default Row if Model has None” and NOT Load records when page is first loaded. Then add a Ui-Only field to this Model called “PopupTrigger” or something like that, type of Picklist. Add a single Picklist Entry to this Ui-Only picklist field, with value “yes”. Now add a Model Action to your “Ui Only” Model. Initiating Events should be “Row in Model Updated”, Fields should be “PopupTrigger” only. Then for Actions, add a single Action: Show Popup. Here, show your table(s) of related records.
So now basically you’ve got a Popup that you can show on demand — all you have to do is to make any change the “PopupTrigger” field on your Ui Only Model’s one row.
At this point you need to cause an update to this field on page load — to do this, I would add a very small bit of Inline JavaScript that checks for records in your Related Record Models, and if so calls updateRow() to cause the update. I have experimented with other approaches that don’t involve JavaScript (using Conditional Rendering on a Field Editor on the Ui-Only Model with the PopupTrigger field in it, marked as Required), but I’m recommending not to go this route.
Here’s a sample page XML (note: this is assuming you are using Banzai):
UiOnly
row.updated
PopupTrigger
{{Name}}: Popup should show on page load if there are related Contact or Case records
Account
Contacts
Cases
(function(skuid){
var $ = skuid.$;
$(document.body).one(‘pageload’,function(){
// CHANGE THESE MODEL IDS ONLY
var MODEL_IDS_TO_CHECK = E
‘Contacts’,
‘Cases’
];
var showPopup = false;
$.each(MODEL_IDS_TO_CHECK,function(i,modelId){
var model = skuid.$M(modelId);
if (model && model.getRows().length) {
showPopup = true;
return false;
}
});
if (showPopup) {
// Update our Ui-only model, this will cause our popup to be shown
skuid.$M(‘UiOnly’).updateRow(skuid.$M(‘UiOnly’).getFirstRow(),“PopupTrigger”,“yes”);
}
});
})(skuid);
Zach, I finally had a chance to play around a bit with your example and it seems to do the trick! I’ll definitely use this to handle my current situation. Thanks for the help!