I want to add SLA color coding to incident list but it is getting apply to form also. I dont want it for form.

Community Alums
Not applicable

I want to add SLA color coding to incident list but it is getting apply to form also. I dont want it for form.

1 ACCEPTED SOLUTION

shamma
Kilo Expert

Hi Shweta,



Please follow the procedure from the below link:


Defining Field Styles - ServiceNow Wiki



As far as I remember if you set the condition value in Field style it will show only on list but if the condition value is null then it will apply on form.



Hope that helps you!



Regards,


Shamma


View solution in original post

8 REPLIES 8

sumeet_n
Kilo Guru

Can you provide some screenshots? OOB it only appears on List view in UI15 and UI16.


Community Alums
Not applicable

find_real_file.png             I dont want color to number on form



find_real_file.png i want color code only to list. but currently it is showing for both



When i update the record color appears on form and when i reopen that form color disappears.




find_real_file.png




checkSLA() script include



function checkSLA(number) {  


       


    //Ensure field style is used only on the list view  


  var listview = true;  


var stag;


  if (gs.getSession().isInteractive()) {  


 


 


  var map = gs.action.getGlideURI().getMap();  


  if (map.get('sysparm_record_target') != null) {  


 


  listview = false;  


 


  }  


  }  


       


    if(listview == true) {  


       


      var gr = new GlideRecord('task_sla');  


      gr.addQuery('task', number);


gr.addQuery('sla.name','CONTAINS','Resolution');  


      gr.addQuery('stage','!=','paused');  


      gr.addQuery('stage','!=','cancelled')


gr.query();


              if(gr.next())


                      {


if(gr.percentage >= 50 && gr.percentage < 75)  


//if(gr.percentage > 0 && gr.percentage < 50)  


                      return 1;              


              else if(gr.percentage >= 75 && gr.percentage < 100)  


                      return 2;  


              else if(gr.percentage >= 100)  


                    return 3;  


              else  


                      return 0;


                //     var color;


                //     stag = gr.percentage;


              }


            // return stag; // it will return current stage  


    // gr.addQuery('stage', 'breached');  


//gr.addQuery('stage', 'in_progress');


  //   gr.query();  


    // return gr.hasNext();  


    }  


}


check at some places semicolon is missing in your code


shamma
Kilo Expert

Hi Shweta,



Please follow the procedure from the below link:


Defining Field Styles - ServiceNow Wiki



As far as I remember if you set the condition value in Field style it will show only on list but if the condition value is null then it will apply on form.



Hope that helps you!



Regards,


Shamma