Code to run a table mass action from a button?

edited June 2019 in Questions

I have a mass action that when all of the rows on a table are selecting pops up and can be run.

Does anyone know if we can create a button that selects all then runs that mass action?

I assume javascript can do it but not sure where to start


  • edited February 2019
    Just to make sure I understand, are you trying to run an action across all the rows in a model?
  • edited February 2019
    Yes. I can add as a mass action on the table (and have).. just wanted to attach it to a separate button

  • edited February 2019
    What does the action do?
  • edited February 2019
    triggers a salesforce flow

  • edited February 2019
    Did you want the button to only run the action on the rows the user has selected, or does it assume they want to run it on all the rows in the model?
  • edited February 2019
    all rows on model be good
  • edited February 2019
    Sweet, that's actually easier to do than trying to figure out what the user had selected. The design is something like this:

    1. On your Model, add a UI only checkbox (I'll just refer to this as UI_Check)
    2. On your Model, add an action When row in model is updated. For the updated field select UI_Check. 
    3. In that model action, add the Data Source action.
    4. On your Button, add an action that Updates a field on a row. Select your Model and the field UICheck, and have it update all rows in the model.
    That should do the job, however it'll only work once since the second try it'll be trying to check a box that's already checked. So on your button you will probably need to add a Branch so that it checks UI_Check if its unchecked, and unchecks it if it is already checked.
  • edited February 2019
    Fantastic work around!

    Thanks Matt
  • edited February 2019
    No problem, hope it works out
  • edited June 2019
    Working on modifying this action framework for transferring all row data between models. But it seems like Model-based actions wont't recognize the row context and instead replicates the first row's information. 

    Safe to assume I'm going to have to use a snippet to properly transfer each row's information to my destination model? The use case is transferring all OpportunityLineItem rows into our Datasource model so we can post to an external data source. 
Sign In or Register to comment.