I don't remember the use case but I do remember a time needing to call a Dynamic Action from some JavaScript code.  It may have been a situation where I wanted to execute some database code from JavaScript and thought it might be easier to put all that code in a Dynamic Action vs. the method of using AJAX to call an Application Process.

Whatever the case, there is a way that this can be done. 

TL;DR: A dynamic action can be defined to fire on a "Custom" event which can be triggered using the jQuery $.event.trigger("<eventname>") method.

I've create an example here

Basically a dynamic action is created with the When Event set to "Custom".  When the Event is set to "Custom" a field prompting for the Custom Event is given.  The value for the Custom Event can be any name that we want to name our custom event.  In this example it is called "DAEvent".  With the "Custom" event the dynamic action still requires the Select Type field.  Set the Select Type option to "DOM Object" and set the DOM Object field to "document".  The dynamic true actions can then be added to perform any functionality desired.

To run the Dynamic Action we then call the jQuery $.event.trigger method with the name of the Custom Event that we defined in the Dynamic Action.  The following line will run the Dynamic Action we created (note that the value passed to the function is the name of the Custom Event we defined in the Dynamic Action).

    $.event.trigger("DAEvent");

In the example we added the line to a JavaScript function defined in the page header which we call when we press a button.

 

Sometimes it's amazing how this stuff works. Enjoy!!!