When Priority changes highlight with color in Activity Log of Incident.

Aac
Kilo Contributor

Hi Team,

I want to highlight color in the Activity log of the Incident when the Priority changes.

In this image I want the side grey bar to be red on Field change(whenever Priority is updated). Or the whole background of this Activity to be red.

I have tried the below in System Properties:

Still it is not working. Please suggest some solution.

Basically I want to highlight in the Activity log with some color whenever Priority changes.

My instance is Kingston.

 

Thanks in Advance.

Aac

 

1 ACCEPTED SOLUTION

Are you OK with priority being BOLD RED? Because getting the background requires more DOM/CSS coding.

use 

cell.style.cssText = "color: red;font-weight: bold;";

//instead of

//cell.style.cssText = "background-color: red";

find_real_file.png

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

View solution in original post

9 REPLIES 9

Please use DOM manipulation as a last resort.

 

That was a client script onLoad on the incident table.

If on madrid set Isolate script : unchecked

You can add it to your list view by hitting the gear icon.

 

find_real_file.png

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

Aac
Kilo Contributor

Hi Kachineni,

It worked. Thanks. But the highlight is quite long. I want it to cover only the Priority word. Can you suggest on this??

 

Thanks

Aac

Are you OK with priority being BOLD RED? Because getting the background requires more DOM/CSS coding.

use 

cell.style.cssText = "color: red;font-weight: bold;";

//instead of

//cell.style.cssText = "background-color: red";

find_real_file.png

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

//Here is the red background with white text

 

 

 

 

function onLoad()
{
//alert('hi on load');
var fieldsList = document.getElementsByClassName("sn-widget-list-table-cell");
for(var i=0; i<= fieldsList.length-1; i++)
{
var cell = fieldsList[i];
//console.log("cell = " + cell.innerText);
if(cell.innerText == 'Priority')
{
var nextCell = fieldsList[i + 1];
if(nextCell)
{
if(nextCell.innerText.indexOf("was") !== -1)
{
cell.innerHTML = "<span style='background-color: red; color: white;'>" + cell.innerHTML + "</span>";
//console.log("Found the priority change cell");
//cell.style.cssText = "background-color: red";
//cell.style.cssText = "color: red;font-weight: bold;";
console.log("color changed to red");
}
}
}
}

}

 find_real_file.png

Mark Correct if this solves your issue.

 

 

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

Aac
Kilo Contributor

Hi Kachineni,

Thanks for the code. It worked. I needed another help.

Each OOB System Property present in the sys_properties table is called from somewhere. I wanted to know from where 'glide.ui.activity_stream.style.work_notes' property is called. This property is used to define the color in activity log for worknotes.

 

I wanted to know this as I need to do some modification on that code. The requirement is as below:

 

Each entry in the work notes will be highlighted by a color that represents the priority of the incident at the time of the entry.

So if the incident is a P4, every time I enter work notes, they will have a green bar (for example), until the priority changes

If the incident is a P3, every time I enter work notes, they will have a blue bar (for example) , until the priority changes

If the incident is a P2, every time I enter work notes, they will have a yellow bar (for example) , until the priority changes

If the incident is a P1, every time I enter work notes, they will have a red bar (for example) , until the priority changes

 

Here is how I would visualize it:

 

find_real_file.png 

 

Please suggest.

 

Thanks

Aac