Action Runner Component

  • 5
  • Idea
  • Updated 2 years ago
  • Under Consideration
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.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb

Posted 3 years ago

  • 5
Photo of Pablo Martinez

Pablo Martinez

  • 2,468 Points 2k badge 2x thumb
+1!
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
slick.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Yup.  That is an interesting idea... Alternatively we could just allow an AF sequence to get run on page load. 
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
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.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
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).
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
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!
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Thanks Zach.  This is something I've done before, a "creative" workaround :)

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!
Photo of mB Andréas K.LeF

mB Andréas K.LeF

  • 1,244 Points 1k badge 2x thumb
See Pat's video below!
Photo of mB Andréas K.LeF

mB Andréas K.LeF

  • 1,244 Points 1k badge 2x thumb
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb