Call action sequence from mass action

I have an action sequence that I’m using as a row action today. It works flawlessly.

I’d like end users to be able to multi-select rows and run the action sequence on each row.

For the action sequence to work, I pass in the DocumentId from the Document__c field to a named input called “document”. That works without issue as a row action.

Here’s the javascript I created to loop through each selected row. It appears the action sequence runs but there is now Id passed to the “document” named input.

Any guidance on changes I can make would be greatly appreciated.

var params =arguments[0];
var $ = skuid.$;
var models = skuid.model.map();

// Get the Document IDs from each selected record
var Ids = skuid.$.map(arguments[0].list.getSelectedItems(),function(item){
return item.row.Document__c;
});
console.log(Ids);

// Loop through each record to download the attachments/documents
$.each(Ids,function(i,row){
var namedInputs = {
“document” : Document__c,
};
skuid.actionSequences.getByName(“DocumentDownload”).run(namedInputs);
});

^ bumping this one for visbility

Ok. This is a hack.

You can make a mass action that updates a UI Only field (Boolean to true). And then use a model “Row update” action on that UI only field to trigger the action sequence. This essentially queues up a series of row actions and runs them sequentially. It might not be a performant as a batched process, but allows you to reuse your current action sequence.

I tried this hack, but unfortunately, the row that triggers the action sequence does not stay in context.

I must pass an Id from each row back to a named input within the action sequence. It’s running the action the correct number of times but is using the Id from the first row for the value of each named input.