For an inline javascript item - how do you run the javascript each time the lightning component is rendered?

  • 2
  • Question
  • Updated 1 month ago
  • Answered

For an inline javascript snippet I've typically used this to run the snippet:


However, this will only run the first time the component is rendered if the Skuid Page is embedded in a lightning component. If you navigate to a different page and then back to the previous page (importantly - this is internal navigation where a full page refresh doesn't take place - e.g. navigating to a different page in a Salesforce Community) - then this inline javascript will not be re-executed.

So, in a nutshell - I need a way for the inline javascript to be executed each time the Skuid page in the lightning component is rendered.


Photo of Louis Skelton

Louis Skelton

  • 3,198 Points 3k badge 2x thumb

Posted 1 month ago

  • 2
Photo of Matt Potts

Matt Potts, Employee

  • 172 Points 100 badge 2x thumb
Hi Louis,

An Event Triggered Action Sequence which uses the event of Skuid Page: Rendered should work. This is then a declarative way to call actions on Skuid Page load. Screenshot below for reference, this is calling two Adopt Row actions.

Photo of Louis Skelton

Louis Skelton

  • 3,198 Points 3k badge 2x thumb
Amazing! I've tested this and it works perfectly - it's exactly what I was looking for. My inline javascript is now instead a snippet which is executed each time the Skuid page is rendered. Ace!