Display an alert message that Incident is breached when ever we open that breached incident?

micky09
Tera Contributor

Display an alert message that Incident is breached when ever we open that breached incident?

6 REPLIES 6

Omkar Mone
Mega Sage

Hi 

Is there any field on your incident form that tells it is breached? If not create a field on incident table which tells you it is breached. 

Write script include to set that field to true(if breached) or false. 

And then create a onLoad client script to check the value of the field you create and display an message in case.

Your business rule will look something like this :-

 

Try using below business rule on Task SLA (task_sla) table which runs after update when Has Breached changes to True

 

 

var incisla=new GlideRecord('incident');

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

incisla.query();

while(incisla.next())

{

gs.log('In loop');

current.inci_breached=true; //considering inci_breached is the checkbox field name on incident form.

incisla.update();

}

 

Thanks for your reply, just one question can we do this by using display business rule & a client script, as SLA table is there in incident form as related list and there is a variable in it has breached which is by default is false.

 

Hi 

Yes definitely. You need to set the value of breached in g_scratchpad in display business rule and use the same in onLoad client script.

siva_
Giga Guru

You can have an onload client script and use script include in that to check task_sla record status for this incident and return the response and based on that you can display an alert or an addInfoMessage onto the form sometimes an alert might not work or work irrespective of condition if you use getXML() for asynchronous processing .Either use getXMLWait() if that issue pops up but note that it will not work in service portal or use an addInfoMessage that will be stayed and will be user friendly

 

Thanks,

Siva

Mark this answer as correct if that helps 🙂