SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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'm making a issue list that should have link to a document library. After registrered I want the dispform.aspx to show a link to the library with filter on the ID from the issue list.

I know ID can't be fetched from the form, but is it possible to retrieve it from the http address and put it in with the link with javascript?

/Forms/AllItems.aspx?FilterField1=look&FilterValue1=My ID from HTTP


share|improve this question

In SharePoint you can use _spGetQueryParam to get a url param like your ID (details on my blog)

var id = _spGetQueryParam("ID");
var url = "/Forms/AllItems.aspx?FilterField1=look&FilterValue1=" + id;
share|improve this answer
This is an absolutely brilliant find! – Vardhaman Deshpande Aug 28 '12 at 18:41

Yes, it is possible to get item Id from display (or edit) form address. They usually have this kind of address:


You can parse ID attribute using this javascript:

var regex = new RegExp("[\\?&]ID=([^&#]*)");
var itemIdValue = regex.exec(window.location.href);
var itemId = itemIdValue[1];
share|improve this answer

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.