SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know I can use {ItemId} to pass it to the URL like so:

<UrlAction Url="~site/_layouts/ConvertItem/ConvertItem.aspx?ListId={ListId}&amp;ItemId={ItemId}&amp;ItemUrl={ItemUrl}"/>

However, I am using JavaScript exclusively. Can I get the ItemID using JavaScript?

<UrlAction Url="javascript:function copyListItems() { res = SPListItemCopy.Resources[_spPageContextInfo.currentLanguage];var listItemID = {ItemId};var listId = {ListId};var context = SP.ClientContext.get_current();var list = context.get_web().get_lists().getById(listId);var item = list.getItemById(listItemID); ..."/>
share|improve this question
up vote 1 down vote accepted

I think the token should be getting replaced anyway, is you second example not working ? also you might nee to wrap the vars with single quotes like var listId = '{ListId}' also your JavaScript functions is not self calling, I think it should be javascript: function copyListItems(){}()

share|improve this answer
It was the quotes. Thanks! – James Grizzle Jan 2 '13 at 15:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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