Issue with the background script

Pooja Khatri
Tera Contributor

I am trying to update my work notes from the background script for condition where impact is null and then impact is set to 5 but my worknotes are not getting updated 

 

Why is the Background script not working ?

Background Script : 

 

My work notes are not getting updatd with the below script

var gr = new GlideRecord('incident');
gr.addEncodedQuery('active=true^impact=NULL');

var text = 'See the following kb article for more info: ';
var url = '[code]<a href="' + 'https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0867584' + '" target="_blank">' + 'Knowledge Article View - Employee Support Center' + '</a>[/code]';
gr.query();

while (gr.next()) {
if (gr.priority == '5') {
gr.impact = '5';
gr.urgency = '3';
gr.work_notes= text + url;
gr.setWorkflow(false);
gr.update();
}

}