Action Runner Component

Ok, this one is a little “out there” but I’ve encountered several situations where it would be very helpful so I thought I would cast the line and see what happens…

I’ve had situations were I need to run a specific set of “Action Framework actions” that aren’t triggered by a UI event.  For example, on page load, I want to automatically open a popup in certain situations.  I can do this today with Javascript but it would be slick if I could put a component at the top of my page where I could define a set of actions to occur.  I could then conditionally render the component to only get displayed in the situations I need it to. When displayed, it just runs its action sequence. 

Enter the “Action Runner Component”…

From the toolbox, you would drag the runner to a page.  In the component properties you could define actions just like you normally would.  When the component renders, it would just run the actions.

+1!

slick.

Yup.  That is an interesting idea… Alternatively we could just allow an AF sequence to get run on page load. 

Allowing action sequence on page load would be helpful, but having the component that contains the action sequence allows flexibility to run it anywhere (e.g. in a popup or drawer, in the middle of a page after certain components render but before others, etc.).  Beyond just the stated use case, you guys have added a lot of events to various components (e.g. beforeload, etc.) but something like this would be a declarative solution for those places where events haven’t been added yet.

Yes, a component that would run an action sequence when it was rendered would be awesomely flexible (as long as we could put rendering conditions on it).

I’ve done this before using a “Dummy” Model with Ui-Only Fields, and then you can have a “When Row in Model Updated” action that triggers a sequence of Actions. Then all you have to do to kick off an arbitrary set of Actions is to set the value of a field on the first row in this “Dummy” Model.

For instance if your Model had 3 fields, you could have 3 “on-demand” Action Sequences that could be run, e.g.

Fields:
ShowConfirmationDialog
RunOnLoadActions
DoSomethingElse

So you would have 3 “Row in Model Updated” Model Actions on this Model, one for each field, with each having a sequence of Actions associated with it. Then all you have to do to kick off a given sequence of actions is to do an “Update Row” on a particular field in your dummy Model.

Hacky, but it works!

Thanks Zach.  This is something I’ve done before, a “creative” workaround :slight_smile:

The downside to the “dummy model” approach is that you need a UI action to occur or write Javascript to trigger the action sequence on the dummy model.  With the “Action Runner Component” you can run your action sequence conditionally (using rendering) anywhere you need it without code and without UI events.

Here’s my use case from yesterday:  I have a single page that supports New & Edit.  For new records, I want to automatically display a popup as a “quick add” type of thing.  If I mark the model as “create on load” and add a model event action sequence, my popup displays.  However, there are certain situations where I don’t want the “quick add” feature (e.g. when a page initialization error has occurred).  Since there isn’t currently a way to conditionally control action sequence items, I needed another approach.  To do this, I need to conditionally add the new row to the model.  To solve for this, I wrote a custom component that has a single property called “models” that, when rendered, simply creates a row in the specified model(s).  I placed conditional rendering on this “Row Creator” custom component to dictate when the row should be created.  I now have a declarative solution with a very simple custom component.

Unfortunately this is just one situation where I need this type of paradigm.  So my options are write a custom component to handle each type of situation or have a component that lets me decoratively configure actions and then conditionally render the component.

There’s really two things that would be ideal:

1) Conditions on Actions
2) Action Runner component

Thanks!

Maybe this can help a little? http://community.skuid.com/skuid/topics/template-component-with-action-framework

This will do this. http://community.skuid.com/skuid/topics/another-use-for-mb-template-w-action-framework-call-action-framework-from-anywhere-on-page

See Pat’s video below!