Colour code incidents

Dear All,

Is there a way of colour coding incidents dependent on their status:

New - Red

In Progress - Yellow

Resolved - Green

Kind Regards

Daniel

Best Answer

Answers

  • Shane_WhiteShane_White Cireson Support Ninja IT Monkey ✭✭✭✭

    Hi @CaterhamITSupport

    You could this to your custom.js file:


    $(document).on('ajaxStop', function () {

    var statusPill = $('.status-pill')

    if (statusPill.length > 0) {

    if(pageForm.viewModel.Status.Name === "Active") {

    for(var i = 0; i < statusPill.length; i++){statusPill[i].style.backgroundColor = "green"}

    }

    if(pageForm.viewModel.Status.Name === 'Resolved') {

    for(var i = 0; i < statusPill.length; i++){statusPill[i].style.backgroundColor = "red"}

    }

    }

    });

    This example will change the background colour if the status is active to green and resolved to red. You can then edit this code to add in other statuses, change the colours etc.

    Let me know what you think!

    Shane.

  • CaterhamITSupportCaterhamITSupport Member IT Monkey ✭

    Can you do a remote in today to show me how this would work?

  • Shane_WhiteShane_White Cireson Support Ninja IT Monkey ✭✭✭✭

    Hi @CaterhamITSupport

    Thanks for the call today I understand what you meant now, here is some code you can put in your custom.js file


    $(document).on('ajaxStop', function () {

    $('[role=gridcell]').filter(function() {return $(this).text() === "Active"; }).css("background-color", "red");

    $('[role=gridcell]').filter(function() {return $(this).text() === "Resolved"; }).css("background-color", "lightgreen");

    $('[role=gridcell]').filter(function() {return $(this).text() === "Submitted"; }).css("background-color", "red");

    $('[role=gridcell]').filter(function() {return $(this).text() === "In Progress"; }).css("background-color", "yellow");

    $('[role=gridcell]').filter(function() {return $(this).text() === "Close"; }).css("background-color", "deepskyblue");

    });


    Let me know if this works,

    Thanks,

    Shane

  • CaterhamITSupportCaterhamITSupport Member IT Monkey ✭

    I copied this in and it didn't work.

Sign In or Register to comment.