Well, if someone still trying to find solution how to archieve run Custom action with multiple selected items via JSON without using any SPManager (not apliable on SP Online for free) or need to edit CommandUIHandler
with VisualStudio (thats the most avaible answer now).
Try this JS, that creats new Custom action with enabled action with multiple selected items.
<script language="javascript" type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
SP.SOD.executeOrDelayUntilScriptLoaded(AddCustomUserAction, "sp.js");
});
var oListItem;
var siteURL = _spPageContextInfo.siteAbsoluteUrl;
var SiteURL2 = _spPageContextInfo.webServerRelativeUrl;
var ListName = "Name_Of_The_List";
var PicPath16 ="/SiteAssets/images/Print_icon_16x16.png";
var PicPath32 ="/SiteAssets/images/Print_icon_32x32.png";
function AddCustomUserAction() {
//Get the client context and list object
var context = new SP.ClientContext.get_current();
var list = context.get_web().get_lists().getByTitle(ListName);
//Get the custom user action collection and add the user action
var customUserAction = list.get_userCustomActions().add();
//Set the location of the user action
customUserAction.set_location('CommandUI.Ribbon.ListView');
//Add the properties for the custom action
var userActionExtension = '<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">' + '<CommandUIDefinitions>' + '<CommandUIDefinition Location="Ribbon.List.CustomizeList.Controls._children">' + '<Button Id="Ribbon.Documents.New.RibbonTest" ' + 'Command="Notify" ' + 'Sequence="0" ' + 'Image16by16="' + siteURL + siteURL2 + PicPath16 + '" Image32by32="' + siteURL + siteURL2 + PicPath32 + '" Description="Shows the ID of the current list." ' + 'LabelText="Show List ID" ' + 'TemplateAlias="o1"/>' + '</CommandUIDefinition>' + '</CommandUIDefinitions>' + '<CommandUIHandlers>' + '<CommandUIHandler Command="Notify" ' + 'CommandAction="javascript:SP.UI.Notify.addNotification(\'ListId={ListId}\');" />' + '</CommandUIHandlers>' + '</CommandUIExtension>';
//Add the command UI extension and update the custom user action
customUserAction.set_commandUIExtension(userActionExtension)
customUserAction.update();
//Load the client context and execute the batch
context.load(list, 'UserCustomActions');
context.executeQueryAsync(function() {
console.log("Custom User Action added successfully to ribbon.");
}, function(sender, args) {
console.log(args.get_message());
});
}
</script>
Source: http://www.c-sharpcorner.com/article/create-ribbon-custom-action-using-javascript-object-model-in-sharepoint-2016-and/
(and yes I know this is 4 years old thread, but i would pay hundreds, if i found this answer earlier.)