Listen for changes on any models based on a certain sObject?

  • 1
  • Question
  • Updated 3 years ago
  • Answered
Is there any way in skuid to listen for changes in any model that is based on a particular sObject?

I suppose I can create an array of models on a particular object with something like this...
var modelsOnMy_sObject=[];
skuid.$.each(skuid.model.map(), function(){
if (this.objectName == 'My_sObject_Name') {modelsOnMy_sObject.push(this);}
});

Would that be a recommended method, or is there something better?

And then subscribe the the models.save event and iterate through the models to see if any of them are in the modelsOnMy_sObejct array?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 3 years ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
This is what I'd recommend.
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
I agree, Matt, I think you've got the right approach.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Thanks, guys!