Domanda

I am trying to add custom action to ECB menu but it is not working. Below is my code:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
   ScriptBlock="function AddCustom(IDItem,IDList){                  
                  var options = {
                    title: 'This is the title of the page',
                    width: 600,
                    height: 600,
                    dialogReturnValueCallback: RefreshOnDialogClose,
                    showClose:true,
                    url: '~site/_Layouts/Custom/ApplicationPage.aspx?Id=     
                          {IDItem}&amp;ListId={IDList}'
                  };
                  SP.UI.ModalDialog.showModalDialog(options);                 
                }"
       Location="ScriptLink">
  </CustomAction>
  <CustomAction
    Id="CA_WF_Init"
    RegistrationType="List"
    RegistrationId="101"
    Location="EditControlBlock"
    Sequence="301"
    Title="My Custom ECB Menu Item" >
    <UrlAction
      Url="javascript:AddCustom({ItemId},{ListId});"/>
</CustomAction>
</Elements>

If i remove the {ListId} parameter then its working properly. Can someone help me to find out what am i missing or doing wrong?

Thanks

È stato utile?

Soluzione

{ListId} is a GUID, i.e. a string (while {ItemId} is an integer). You should probably use quotes arround this parameter:

   <UrlAction
      Url="javascript:AddCustom({ItemId},'{ListId}');"/>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top