We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

The color of list view of the 'number' field must be changed according to the SLA.(e.g. green for less than 50%, yellow for 50 to 75% and red for 75%+)

snajaykumar1234
Kilo Expert

The color of list view of the 'number' field must be changed according to the SLA.(e.g. green for less than 50%, yellow for 50 to 75% and red for 75%+)

give example for this scenario.

Thanks

Sanjay

14 REPLIES 14

You go to the table you   are showing:   In the Value field:


enter the following code;   javascript: GlobalFunctions().getSLAStage() >75 && <100


and in Style: Enter: background-color:orange.


Like this you can color code for <=50% to be green and   >=100 to be red.


I hope this helps.



On the number field in the incident form


Click on Configure Styles.


Click New and then write this thing



See the screen shot


find_real_file.png


snajaykumar1234
Kilo Expert

Thanks Aakash,



i write three styles based on conditions..i am trying to call script include from style. how can get SLA 50% reached or else..


how can write code .



below code is breaches scenario but i need sla <50% and sla>75 and sla>50 && sla<75




var gr = new GlideRecord('task_sla');  


              gr.addQuery('task', number);  


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


              gr.query();  


              return gr.hasNext();



thanks


sanjay


Did you check this



You can achieve what you are trying to do following these steps:



First create a script include named new GlobalFunctions,



API Name: global.GlobalFunctions


GlobalFunctio


and script as below;


var GlobalFunctions = Class.create(0;


GlobalFunctions.prototype = Object.extendsObject(AbsstractAjaxProcessor,{


                    getSLAStage: function() {


                    gs.log("script called");


                    var stag = ' ';


                    var gr = new GlideRecord('task_sla');


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


                    gr.query();


                    if(gr.next())


                                                    {


                                                      var color;


                                                      stag = gr.percentage;


                                                      }


});



Make sure you check 'client callable and Active to be true.



Then you go to the table you   are showing:   In the Value field:


enter the following code;   javascript: GlobalFunctions().getSLAStage() >75 && <100


and in Style: Enter: background-color:orange.




Like this you can color code for <=50% to be green and   >=100 to be red.


snajaykumar1234
Kilo Expert

sla.png


i can use 3 conditions for style like above pic..


in case any wrong please suggest me.



thanks


sanjay