There is a table called u_xyz and one of fields called u_priority and priority has a values (none, 1

Abhishek Kathe
Mega Guru

There is a table called u_xyz and one of fields called u_priority and priority has a values (none, 1, 2, 3) so, In my list view I want to give the red color to that perticular row which has a priority 1

9 REPLIES 9

Pankaj kr
Kilo Sage

Hi Abhishek,

 

Pls refer below link and the subsequent link in that page to have a better understanding of the solution.

 

Url: Highlighting a row in a list view - Support and Troubleshooting (servicenow.com)

 

Please mark my answer as helpful and the solution accepted if it serves the purpose.

Regards
Pankaj Kumar

 

Hi @Abhishek Kathe,

 

It is not possible to color any row in the list view, instead you can color a particular field using the field styles and for optical reading purpose you can pull that column in as the first column of your list. This is an alternate solution i am thinking of. Others please suggest if anything similar to this can be deduced. 

 

Please mark my answer as helpful and the solution accepted if it serves the purpose.

Regards
Pankaj Kumar

Amit Verma
Kilo Patron
Kilo Patron

Hi @Abhishek Kathe 

 

Please have a look on the below post :

https://www.servicenow.com/community/itsm-forum/in-incident-form-field-label-should-in-red-color-whe...

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

Anil Lande
Kilo Patron

Hi,

You can achieve this using field style. But, your requirement is to show complete row in Red Colour which is not possible with one field configuration. You need to use same logic for all the field in your table then only it will show ROW as RED.

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0813425

https://docs.servicenow.com/bundle/vancouver-platform-administration/page/administer/navigation-and-...

 

If you make configuration for one column then it will make that particular field RED.

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

SumanthDosapati
Mega Sage
Mega Sage

Hi @Abhishek Kathe 

 

Option 1 (Without script) :

  1. Navigate to System UI > Field Styles
  2. Create New
  3. Give your table name and field name
  4. In style you can give this background-color:red;
  5. Save.
  • If you want it conditional basis then in value field you can write as below (This is for list view)
javascript: current.u_priority== "1" || current.u_priority== 1

 

Option 2 (Client script):

This method is for conditional basis and only on form view

Write an onLoad/onChange client script as below

var priorityField = g_form.getElement('u_priority');
	   if((g_form.getValue('u_priority') == '1') || (g_form.getValue('u_priority') == 1)) {
		   priorityField.setStyle({color: "white"});
		   priorityField.setStyle({backgroundColor: "red"});
	   }

 

Regards,
Sumanth