- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2016 03:32 AM
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)
Pls describe how can i achieve this.
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2016 09:49 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2016 06:11 AM
Hi Jayanthi,
Replace GlobalFunctions with your script include name or you can give same name for your script include as GlobalFunctions.
Hope it will help you.
Regards,
Swapnil
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2016 09:49 PM
Hi Swapnil.
i have named my script include as "DotColorerSLA"
and API name is "global.DotColorerSLA"
And i have used the code as you have provided
""
var GlobalFunctions = Class.create();
GlobalFunctions.prototype = Object.extendsObject(AbstractAjaxProcessor,{
getslaper : function() {
var per = '';
var gr = new GlideRecord('task_sla');
gr.addQuery('task', current.sys_id);
gr.query();
if(gr.next())
{
per = gr.percentage;
}
return per;
}
});
""
And i have tried the value field by replacing GlobalFunctions with scriptinculde name as
javascript:new global.DotColorerSLA().getslaper()=100
javascript:global.DotColorerSLA().getslaper()=100
javascript:DotColorerSLA().getslaper()=100
javascript:new DotColorerSLA().getslaper()=100
but still out of luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2016 09:59 PM
Hi Jayanthi,
Use below modified code and just copy & paste it in your script include:
var DotColorerSLA = Class.create();
DotColorerSLA.prototype = Object.extendsObject(AbstractAjaxProcessor,{
getslaper : function() {
var per = '';
var gr = new GlideRecord('task_sla');
gr.addQuery('task', current.sys_id);
gr.query();
if(gr.next())
{
per = gr.percentage;
}
return per;
}
});
After this script include define the field style for number field.
Follow below steps to define style:
1. Right click on Number field -> Click on Configure style->Click on New button.
For 80% define below value and style for Number field
Value: javascript:DotColorerSLA().getslaper() >=80
Style: background-color:Orange
For 100% define below value and style for Number field
Value: javascript:GlobalFunctions().getslaper() >=100
background-color:Red
Hope it will help you.
Regards,
Swapnil
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2016 06:00 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2016 12:42 AM
You should use '==' instead of '=' in your condition.