How to change color of dot before incident with respect to SLA

pushparaj
Mega Contributor

Hi we have a requirement like in the ITIL home page we need to display a dot before incident number which is based on SLA duration
No Dot if SLA duration is   <80%

Amber (orange) dot when SLA hits 80% duration
if SLA breached or touched 100% then a red dot needs to be shown.

( see the image attached)

req.jpg

Pls describe how can i achieve this.

Thanks in advance

1 ACCEPTED SOLUTION

sraghunath
Tera Contributor

Hi,


I am able to achieve it using below code: and its working fine for me:



In Style : value :: javascript:DotColorerSLA() > 80


                            Style :: background-color:red;



Script Include :--> DotColorerSLA()



function DotColorerSLA() {


              var per = '';


              var gr = new GlideRecord('task_sla');


              gr.addQuery('task', current.sys_id);


              gr.query();


              if(gr.next())


                      {


                      per = gr.business_percentage;


                      }


              //gs.addInfoMessage("per-->"+per);


              //gs.log("per-->"+per);


              return per;


      }






PS: Hit like, Helpful or Correct depending on the impact of the response


View solution in original post

13 REPLIES 13

How are you testing it ? Field styles with javascript: will work only on list layout and not on form layout.



Also the 'new' keyword is missing in the field style call.



Syntax:



javascript: new scriptincludename().functionname();


I have been verifying it in list layout only not in the form.
and i have been using "==" only i pasted here wrong by mistake.
and after all this any idea why the indicator is not appearing in the list view.


sraghunath
Tera Contributor

Hi,


I am able to achieve it using below code: and its working fine for me:



In Style : value :: javascript:DotColorerSLA() > 80


                            Style :: background-color:red;



Script Include :--> DotColorerSLA()



function DotColorerSLA() {


              var per = '';


              var gr = new GlideRecord('task_sla');


              gr.addQuery('task', current.sys_id);


              gr.query();


              if(gr.next())


                      {


                      per = gr.business_percentage;


                      }


              //gs.addInfoMessage("per-->"+per);


              //gs.log("per-->"+per);


              return per;


      }






PS: Hit like, Helpful or Correct depending on the impact of the response


ravin
Giga Contributor

Your solution was very much helpful dear !!! Thank you !