How to show the percentage field of sla in portal?

ManikandanP7586
Giga Contributor

Need to show percentage with color change in portal like actual elapsed time field in task_sla table, is it present in OOB 

1 REPLY 1

Satyapriya
Mega Sage

Hello @ManikandanP7586 ,

Yes — Service Now does have an OOB way of showing SLA percentage elapsed with color indicators (green/yellow/red) exactly like you see for the Actual elapsed percentage field on the platform — but it is not shown automatically on the Service Portal.

If you want to show the SLA progress bar in portal widgets, you need to use the SLA Timer/SLA Percentage directives, which are meant for this purpose.
Please try using this in your widget html body
<sn-record-sla-timer
table="'task_sla'"
field="'percentage_elapsed'"
sys-id="{{sla.sys_id}}">
</sn-record-sla-timer>


And make sure to use this in your widget server side script
var sla = new GlideRecord('task_sla');
sla.get('<task_sla_sys_id>');
data.sla = sla;