I am looking at trying to run some code against a list object when a user is viewing it. (for example, when a user views an item to, on load, updating the item with a 'has been viewed' field to 'true')
My thought process is to run a piece of javasript to somehow, when the page loads with the item, to find the current item ID. Then, by using some other piece of code, to update the field automatically and save it.
I am just unsure how to effectively get the item ID using JS (Im relatively new to both SP and JS)
From what I can tell, the ID is in the url (in this case, it's '58') -
What would be a suitable peice of JS to get this value when the page loads, and out of interest, what would be the suggested way to then programatically update the object field and save it?