Call StandardSetController from Skuid Table

  • 1
  • Question
  • Updated 5 years ago
  • Answered
I have an Apex custom action that takes list of object IDs, extending StandardSetController. In SF, I have been able to pass in the object IDs. How do I do that from Skuid table?
Photo of jaehocho

jaehocho

  • 180 Points 100 badge 2x thumb

Posted 5 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,262 Points 20k badge 2x thumb
You need to add a Mass Action of type "Custom" to your Skuid Table --- this allows you to select multiple records, and then you can use these selected records in a JavaScript snippet to redirect to the Apex Page that has the StandardSetController.

Follow this tutorial for creating a Custom Mass Action, only replace the Snippet Name, Action Label, and Action Icon with whatever makes sense for you, and then, for the Snippet Body, use the following instead so that the Ids passed in will be sent to a Visualforce Page of your choice in a format that will be processed by the StandardSetController:

(just replace TARGET_URL with the URL of your Visualforce Page):



var TARGET_URL = '/apex/MassPreregister' + '?retURL=' + encodeURIComponent(window.location.href);
var url = TARGET_URL;

// Get the Ids of the selected items as an Array
skuid.$.each(arguments[0].list.getSelectedItems(),function(i,item){
if (!skuid.model.isNewId(item.row.Id)) {
url += (((i===0) && (TARGET_URL.indexOf('?')===-1)) ? '?' : '&')
+ 'ids=' + item.row.Id.substring(0,15);
}
});

window.location = url;



This would produce something like this: