Skip to main content
Nintex Community Menu Bar
Question

Trigger Mass Action via Javascript Snippet

  • July 10, 2024
  • 2 replies
  • 1 view
  • Translate

Forum|alt.badge.img

Is there any way to trigger a mass action on a table via Javascript Snippet.

I have a table with a mass action attached to it.  I’d like to be able to trigger that action in a snippet.

Thanks!

Did this topic help you find an answer to your question?
This topic has been closed for comments

2 replies

Forum|alt.badge.img+4

There’s likely a better way, but I was able to do this by using jQuery to target the button which normally triggers the desired mass action and then forcing a click on it. Here’s my code:

var $ = skuid.$,
    action = arguments[0].action,
    list = arguments[0].list,
    model = arguments[0].model; // Force all checkboxes (for each table row) into checked state
$('#sk-3GF2wd-4635 input[type=checkbox]').prop("checked",true); // Trigger a click on the button which triggers the mass action
$("#followupTable div.nx-massactions div:eq(0)").click(); 

I found the selector for the checkboxes and the mass action using Chrome’s devtools. There are a lot of guides around if you’re unsure of how to do this yourself. Here’s a decent one.

Here’s how I attached the snippet to a save button on my layout:

Hope this helps and I’m happy to help clarify if needed. Also curious if anyone found a “nicer” way of doing this.

Translate

Forum|alt.badge.img+7

Kathryn,
Thanks for posting this! You might find this method a little “nicer”, as it doesn’t require manually picking out DOM elements:

var $ = skuid.$, list = arguments[0].list, selectedItems = list.getSelectedItems();


selectedItems should return information about the associated element, row, etc.
Hope this helps!
Emily

Translate

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings