0

Here is the original post about the Stoplights for SP 2016 on prem.

Stoplight Indicators Pulling From Multiple Columns

This is the script I have on the page that rendered the Stoplight

<script src="https://code.jquery.com/jquery-1.11.3.min.js" type="text/javascript"></script>
<script type="text/javascript">
(function () {
 var overrideNameField = {};
 overrideNameField.Templates = {};
 // This action will edit the "Indicator" field. You can change the "Status" to another column.
 overrideNameField.Templates.Fields = {
 "Status Indicator": { "View": overrideNameFieldTemplate }
  };

  SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideNameField);

 })();
function overrideNameFieldTemplate(ctx) {
 //get the column value.
var currentVal= ctx.CurrentItem["Status Indicator"];
// Render the column
return "<div style='font-weight:bold; font-size:50px; color:"+currentVal+";'>•</div>";
}
  </script>

It has worked perfectly for the last two years. We are still in classic view. If there are any pointers out there on how to update that script to work with 2019 on prem that would be wonderful.

Thanks

5
  • Where did you import this JavaScript file. Use JSLink to make this script to work Dec 16, 2020 at 5:55
  • It was placed directly under the list and worked for over 2 years wonderfully. After the migration, I tried using JSLink and that too did not work.
    – user79745
    Dec 16, 2020 at 9:25
  • @ChrisL I have tested the original script in SharePoint Server 2019, and it is working just fine. Make sure you use the internal name instead of the current display name of the column in the script. Delete the Script Editor web part from page and then add the script again. Dec 17, 2020 at 8:54
  • @Chelsea_MSFT I did all that and still nothing. The MDS is not active, either.
    – user79745
    Dec 27, 2020 at 7:21
  • @ChrisL Not sure what the problem is, but maybe try using the script in a new created list and see if it works. Might have something to do with the migration process. Dec 28, 2020 at 5:31

0

Your Answer

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

Browse other questions tagged or ask your own question.