I create a View Ribbon-scoped custom action using SPD 2010 that runs some Javascript. If I create it in an ECT list I can use it with multiple items. However, if I create it in a standard SharePoint list, it automatically grey's out when more than one item is checked.

Can this behavior be changed from SPD? Using JSOM? Some other tool or VS? (In that order)

3 Answers 3


SPD is rather clever. If you put tokens like {SelectedItemId} into the 'url' it makes sure the button is only enabled if a single item is selected, but if not the it's turned on always.

Try this as an example:

  • Good to know. My URL looks like this . . . javascript:$.getScript("http://intranet/path/popNewOpp.js"); . . . so not sure what else might be hapening.
    – Toadmyster
    Commented May 11, 2012 at 20:21
  • I haven't found this answer to hold true under some circumstances.
    – Dinerdo
    Commented Jul 22, 2015 at 16:43
  • Sorry to bring up an old thread, but I wanted to elaborate on this since it helped me. The custom action must not have a token in it when created to have it not grayed out on multiple selections. After deleting mine and readding without a token this works. This should be marked as the answer as it's a built-in solution Commented Jan 20, 2017 at 16:59

Here's the quick and dirty. SPD creates the UserCustomActions definition for the list with code to only display for a single item. Using SP Manager, I simply edited the script to allow for any number of selected items to enable the icon in the ribbon. (Changed ==1 to >0) SP Manager Left Panel!enter image description here


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  
            //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  
            //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) {  

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.)

  • You have CommandAction="javascript:SP.UI.Notify.addNotification(\'ListId={ListId}\'); - there is no multiple values, as I understand..
    – Gennady G
    Commented Sep 24, 2018 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.