0

I want to create a link on a page that points to the 1st item in a particular list. I achieved this using ID as a parameter but when I deleted the list item and re-created, the ID has changed and link no longer works. Is it possible to create a link that always points to the 1st item (not using the ID)?

Its the edit form I need to get to:

ht...//mydomain.com/sites/Project/sample/Lists/Project/EditForm.aspx?ID=5&ContentTypeId=0x01009EE4EA92B1DBE24AAB501E88273687B5

1 Answer 1

2

I don't think there's a way to tell the edit form to automatically open the first item per se, but if you had the time you could create a page with a PageViewer web part that links to the edit form and then write some JavaScript code to look up the list through the CSOM, determine what the lowest ID is, and then replace the ID portion of the query string with that number.

If you're going to go to that extreme, I would actually eschew using ID altogether and grant yourself the flexibility of making your JS look up the first file with, say, a Yes/No field set to "true". That way you wouldn't necessarily have to delete older versions of that first item, you'd just set the first one you'd want to use to "yes".

1
  • 1
    SP2013 workarounds tend to rely on creative javacript snippets.
    – klewis
    Feb 5, 2016 at 23:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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