Flashing a field in the list view

SwarnadeepNandy
Mega Sage

Hi,

I am new to serviceNow. I was stuck in a problem. I want to flash a field in the list view of the table. The flashing will be based on, any update via email on a particular record.

I have tried a piece of simple javascript code in "Values" field in styles.

function initBlink()
{
   
var state = false;
  setInterval
(function()
   
{
  state
= !state;
   
var color = (state?'red':'green');
  document
.getElementById('test').style.color = color;
   
}, 1000);
}


Looking forward for your help.

1 ACCEPTED SOLUTION

epam
Kilo Guru

Hi, Swarnadeep.



If I understand your question properly, the incident is updated by inbound email actions.



So You can do following:



- the Inbound Email Actions script should mark the incident any way your prefer (e.g. current.comments = "incident was updated by email")



- As Berny Alvarado and Jim Coyne say: create a special style (using Field Styles) on a list based on a condition like this:



      javascript:current.comments.indexOf('updated by email') > 1



To create a flashing dot near some field (I tested it on Fuji): Upload an animated gif to System UI -> Images and write a field style like this:



      background:transparent url('flashing.gif') -20px -20px no-repeat;




- Create a List Button for incident table (System UI -> UI Action) with script like this:



function startReloadList(){


      location.reload();


}


setTimeout(function() { startReloadList(); }, 10000);



The script refreshes list every 10 seconds. Also You can insert "startReloadList()" into the onclick field to reload the list by the button.


View solution in original post

11 REPLIES 11

Thanx Andrii.


Can u help me with the coding?


I'm not - don't have much time now, but the epam expert might help you with this.


bernyalvarado
Mega Sage

Hello, you can set Styles on a list based on a condition using Field Styles


http://wiki.servicenow.com/index.php?title=Defining_Field_Styles#gsc.tab=0



I believe there's an obsolete and non cross browser compatible style: text-decoration: blink. Overall, "blinking" an item is not recommended. Would it help your requirement if you set the Incident Number Field Style to something like background-color: red? On your list It will then appear a red dot next to the Incident number. You can also display images with code like the one is used for VIP users:



background-image: url('images/icons/vip.gif');


background-repeat: no-repeat;


background-position: 98% 5px;


padding-right: 30px;



I hope it helps!



Thanks,


Berny


And to follow up on Berny's suggestion, you could use an animated gif to do the "flashing" effect that you want.   Not a big fan, but that would be the easiest and codeless way of doing it.