I have an SP list with a hyperlink column. If someone click on it I would like to get the ID of the row and store it before redirect to the next page. I am new to both SP and JS so any idea how to approach this is welcome! Thanks you for the help!

  • You could probably use JSLink for the same to achieve. In that you might mention click event when hyperlink is clicked so that you can save the current item ID.
    – Pradip R.
    Oct 30, 2017 at 11:37
  • Thanks you very much for the idea, I am looking into it! :)
    – Nefri
    Oct 30, 2017 at 12:18
  • Using Content Query web part and display required fields. When anyone click on the item it will redirect to row ID.
    – san
    Oct 31, 2017 at 4:37

1 Answer 1


For getting row ID on clicking item. You need to implement jslink on column and implement rendering as bellow shown It helps you for for question.

(function () { 

    // Create an object that have the context information about the fields that we want to change the rendering of.  
    var priorityFiledContext = {}; 
    priorityFiledContext.Templates = {}; 
    priorityFiledContext.Templates.Fields = { 

        // Apply the new rendering for these fields on List View 
        "Overall_x0020_Status": { "View": priorityFiledTemplate }, 
        "Time_x0020_Status": { "View": priorityFiledTemplate },
        "Cost_x0020_Status": { "View": priorityFiledTemplate },
        "Scope_x0020_Status": { "View": priorityFiledTemplate }



// This function provides the rendering logic for the list view 
function priorityFiledTemplate(ctx) { 

    var priority = ctx.CurrentItem[ctx.CurrentFieldSchema.Name]; 

    // Return html element with appropriate color based on value 

    switch (priority) { 
        case "Red": 
        //Instead of the word "red" show and image from the Style Library
            return "<img src='https://decode247.sharepoint.com/Style%20Library/red.png' align='center'>";
        case "Yellow": 
            return "<img src='https://decode247.sharepoint.com/Style%20Library/yellow.png'>";
        case "Green": 
            return "<img src='https://decode247.sharepoint.com/Style%20Library/green.png'>";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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