Skip to main content

I have a script running for a row level action that adds a set of lessons for one of a set of students in a table i would like to add a mass action so that various students can be selected and lessons added for all of them at once do i get an array of rows as an input to a snippet attached to a mass action ?

what i found poking around in the console is that i can look at the models “registered items”/“selected” property and see which rows are selected… if that’s the canonical way to do this then I’m good to go


Hi Ken, For others that are reading this, here are a few examples of how to use a Mass Action to retrieve the selected items and perform an action on all selected rows: How to add a “Marketo Send Email” mass action to a Skuid table Drawloop mass mail merge But as far as technically, what is passed into a Mass Action Snippet, you are passed a JavaScript object with the following parameters:

  • model - the Table’s Model
  • list - the underlying skuid.ui.List object for the Table
the list parameter here is the most useful. While we do not have official documentation on skuid.ui.List yet, one of the supported methods of List is getSelectedItems() which returns a reference to the skuid.ui.Item objects that have been selected. Each skuid.ui.Item has a reference to its associated Model row, so here are some examples of code which you can use to get at the selected Rows: Example 1: Build an Array of the Model Rows corresponding to the selected Items in a Table


// Get the Ids of the selected items as an Array var selectedRowsArray = skuid.$.map(argumentsu0].list.getSelectedItems(),function(item){ return item.row; }); 

Example 2: Build an Array of the Ids of the rows corresponding to the selected Items in a Table, then join them into a comma-separated String of Ids


// Get the Ids of the selected items as an Array var idsArray = skuid.$.map(argumentsu0].list.getSelectedItems(),function(item){ return item.row.Id; }); // Convert this array to a comma-separated String var idsString = idsArray.join(','); 

Example 3: For each selected Contact in a Table, create a corresponding CampaignMember record for a specified Campaign


// Here, our Table is on a Contacts Model var campaignId = '701U00000002OS3'; var CMModel = skuid.model.getModel('CampaignMembers'); // Create a new Campaign Member for each selected Contact skuid.$.each(argumentsu0].list.getSelectedItems(),function(i,item){ var newCM = CMModel.createRow(); CMModel.updateRow(newCM,{ 'ContactId': item.row.Id, 'Contact': item.row, 'CampaignId': campaignId }); }); CMModel.save(); 

How could I use the second email and the mailto command, to relay the array of emails (rather than IDs) to native mail client, Outlook, bcc field?