Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Running Countdown Timer on Incident form

Deepak Negi
Mega Sage
Mega Sage

Hi

I need to create a countdown timer on Incident Form which:

1. Runs continuously on the basis of current SLA's Time Left.

2. Pauses when the SLA is paused.

3. Refreshed when a new SLA is attahced to the Incident.

I have tried a timer using formatter and UI macro but I am not getting the exact logic to set the time for countdown.

Appeciate you help !!

Thanks

Deepak

5 REPLIES 5

Prasad Dhumal
Mega Sage

You need to create UI Macro and first add Watch image into db_image table.

I am sharing Script which needs to be add into UI Macro

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<img src="CountDown.png" style='width:25%; height:25%' onclick="watchSLAtime()" title="${gs.getMessage('Showing live SLA time')}" > </img>
<script language="javascript">
function watchSLAtime(){

var tablename = 'task_sla';
var url='https://dev76169.service-now.com/task_sla';   // Add your task_sla form link
var window=getTopWindow();
var name = g_form.getValue('number');
var url=tablename+'_list.do?';
url+= 'sysparm_query=task.numberSTARTSWITH'+name;
window.popupOpenFocus(url,'sys_ref_list',700,500,'',false,false);
}
</script>
</j:jelly>

 

Then you can add this UI Macro through Dictionary.

 

Please mark my answer as correct and close the thread so that others can also benefit.

Regards

Prasad Dhumal