Skip to main content

Posts

Showing posts from October, 2017

Putting an button on each line item & updating list with calculated column

Recently I was working on a feature which required me to put a button on every item in the SharePoint list's view. The button name was Assign Me . When clicked, it should update the item and put the current logged in user in the Assigned To field. I followed a hybrid approach. calculated column and custom JavaScript . I tried doing everything in calculated column.  Even though calculated columns allow writing code in JavaScript, they still have some limitations. One of the biggest hurdle is to get the ID of the item. Since calculated columns do not allow ID column, you have to be innovative. I figured out that the checkbox column in every line item has id in the tag. This is always the first column in the view (first td in the tr). Following are the steps I followed to achieve the desired result.  Step 1. Create a new calculated column with output as Number.  Step 2. Put the following formula. I use Typescript, hence replace class name with you...