Polling status from salesforce remote action and update the components on Skuid page

  • 1
  • Question
  • Updated 1 year ago
  • Answered
Let's say I have a meeting page which is built on skuid.
The meeting host can stop the meeting clock or pause the meeting clock.
If the meeting status changed. All the opened meeting pages should be reflected for those attendees.
For example, when the timer is paused. The vote or comments component should be hidden or READ-ONLY.

My approach is that I will run a Javascript snippet in the background and keep polling the status via  Salesforce remote actions.
Once the status changed, I will disable/enable some Skuid components.
The thing is any direction to disable or re-query models by polling the status in the background.

Just have no idea how to re-query models or hide components using Javascript within a skuid page.

Any idea or direction?
Photo of Poc

Poc

  • 496 Points 250 badge 2x thumb

Posted 1 year ago

  • 1
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Poc,

Here is the Skuid API documentation-> https://docs.skuid.com/latest/en/skuid/api/skuid_model.html

You can load (i.e. re-query) a model with something like:
var oppmodel = skuid.model.getModel('OppByProduct');
oppmodel.load();
You can show/hide a component by locating its unique identifier and issuing the following:

skuid.$('#sk-PQVRj-123').show();
skuid.$('#sk-PQVRj-123').hide();
Thanks,

Bill
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Hi, Bill!
Ideas on querying a model periodically??? Like every 30 seconds? I tried to cobble together some code as inline javascript based on setInterval, but I can't get it to work.
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Raymond,

Zach created a page that queries a model every 10 seconds.  You can find the sample page here->  https://community.skuid.com/skuid/topics/real-time-dashboards

Thanks,

Bill
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Awesome! Thanks, Bill.
Photo of Poc

Poc

  • 496 Points 250 badge 2x thumb
Nice explanation! Will try it~~