- 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 04:01 AM
Hi Jayanthi,
Create Script include and then call the script include in field style.
Script include code:
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())
{
stag = 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.
Refer below screenshot to fill req. info.
2. Just change the value field for 100% and also change the background color red same as screenshot.
Use below value for 100%.
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-19-2016 04:54 AM
Hi Swapnil
I have created the script include in system definitions.
And i have also configured styles.
And i tried to see the changes in "incident-> all" page, but i saw no changes there.
is there some i missed or is the place i am viewing wrong ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2016 05:02 AM
Hi Jayanthi,
I would suggest you create a new record and then check the changes.
It might not reflect the changes for old records.
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-19-2016 05:52 AM
hi swapnil i have tried to do it.
but no luck.
and in the system logs i am getting a message called
org.mozilla.javascript.EcmaError: "GlobalFunctions" is not defined.
Caused by error in <refname> at line 1
==> 1: GlobalFunctions().getslaper()=100
does this mean anything i need to enable in my instance