Can you save action sequences to a separate file to reference from multiple pages?

Hi, Skuid Community!

I’m building out a set of pages where I want to use a lot of the same action sequences on multiple pages. Can action sequences be referenced from something like a page includes (such as by ID) from pages needing to use the same code? I want to avoid having to maintain similar code across multiple pages as new features have been added. I basically want to do the same thing as referencing a JS resource file with a set of action sequences.

Thanks!

  • Meredith

You could perhaps try modifying the XML directly to call the action sequence with the ID from the other page, though that seems messy and I’m not sure if it would work properly.

You can also use javascript and the window variable.

Let’s say you have a main page with your action sequences. On page load you can run a javascript snippet with the following code:

window.MyActionSequence = skuid.actionSequences.getByName("MyActionSequence")

now on any pages included in this page, you can call your action sequence via a javascript snippet as follows:

window.MyActionSequence.run();

You could also use this javascript method to have a page include that has all of your action sequences in it, and on loading of that page include set the window variables that are then able to be referred to by the page that it is included on. You’d just want to be careful that the page include loads prior to trying to run any of the action sequences on that page include.

1 Like

Mark, that is a great suggestion to add the action sequences to a separate page includes, then call them from JS. These action sequences don’t need to run on page load, so I think it would work. I’ll test this out. I appreciate the idea!

  • Meredith