I'm somewhat new to SharePoint and I need help updating columns using javascript.

I have a list that tracks expiration dates and shows traffic lights based on the days away from that expiration date.

So what I thought was to have a dynamic today column to do DATEDIF with the expiration date.

In order to do this, I created a calculated column with the formula <p class="todayDate"></p> and added a content editor webpart to set the innerHTML of todayDate class elements to today's date as string.

The problem with this is that I cannot use the today column for formulas in other calculated columns(When I do [Today], it returns <p class="todayDate"></p>, not the innerHTML).

So my new approach is to do all the date difference calculation in javascript and update the status column with the traffic light color(yellow, green, or red).

The closest thing I found on the web related to this problem is https://msdn.microsoft.com/en-us/library/office/hh185011%28v=office.14%29.aspx

But I'm not sure where in the site I'm supposed to add that script.

Could somebody guide me in the right direction?

Thank you in advance.

1 Answer 1


Here are the sites you may want to read:

If you think this is a valid answer, please mark it so

The above sites will help you create Views like this:

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.