Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

1 Answer 1

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
1  
It was the quotes. Thanks! –  James Grizzle Jan 2 '13 at 15:55

Your Answer

 
discard

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.