How to change the color of the user added worknotes in the activity

Community Alums
Not applicable

Hi Team,

 

There is a requirement to change the color of user added worknotes to blue or any other color. So that it can be easily identified which is added as system notes and which is added as user notes

Ankur20_0-1680877613873.png

 

2 ACCEPTED SOLUTIONS

@Community Alums 

 

While its not ideal to run DOM, you could use an onload client script to do it: 

 

 

function onLoad() {
	var divs = document.getElementsByClassName('h-card');
	for(var i = 0; i < divs.length; i++){
		if(divs[i].innerHTML.indexOf('System') != -1){
			var html =  divs[i].innerHTML;
			html =  html.replace(/gold/g, "red"); 
			divs[i].innerHTML = html;
			//console.log(divs[i]);  
		}
	}
}

 

View solution in original post

@Community Alums 

I would change it back to "h-card" since the "h-card-wrapper" will update all cards with gold if any "system" text is found within all cards. Here is what I get when I use "h-card" class name reference. 

DomGattuso_0-1681223415506.png

I am not sure why the notes tab is getting changed to red as well for you, that does not occur for me 🤔 does you notes table have the gold color in it by chance?

View solution in original post

14 REPLIES 14

Dom Gattuso
Mega Sage

I don't think there is a way to dynamically change the color based on conditions. I do know the color is set through a system property called "Glide.ui.activity_stream.style.work_notes", if that helps.

Community Alums
Not applicable

There should be someway? Can we write any script to achieve this?

@Community Alums 

 

While its not ideal to run DOM, you could use an onload client script to do it: 

 

 

function onLoad() {
	var divs = document.getElementsByClassName('h-card');
	for(var i = 0; i < divs.length; i++){
		if(divs[i].innerHTML.indexOf('System') != -1){
			var html =  divs[i].innerHTML;
			html =  html.replace(/gold/g, "red"); 
			divs[i].innerHTML = html;
			//console.log(divs[i]);  
		}
	}
}

 

Community Alums
Not applicable

What is 'h-card' ?

I tried to run the above code but its not working. I can see you are replacing 'gold' with red, How to get worknotes ?

Also the below condition is not passing.
 if (divs[i].innerHTML.indexOf('System') != -1)