Copy RITM Short Description to REQ Short Description (Business Rule)

TempestT-37
Tera Contributor

I am trying to copy the RITM Short Description to REQ Short Description. I have 'when to run' set to async - insert. I have tried both before and after with little success.  Action has nothing set. in the advanced tab my code is below. This code will work on some of my request but not most of them. Thank for any help.

 

var gr = new GlideRecord('sc_request');
gr.addEncodedQuery('short_descriptionISEMPTY');
gr.query();

while (gr.next()){
	var gRitm = new GlideRecord('sc_req_item');
	gRitm.addQuery('request',gr.sys_id);
	gRitm.query();
	while(gRitm.next()){
		gr.short_description = gRitm.short_description;
		gr.update();
	}
}

 

 

 

6 REPLIES 6

did you ever get this fixed ? im running into the same issue

Bert_c1
Kilo Patron

Hi All,

 

You could be affected by:

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0713029

 

Where the use of "gr" as a GlideRecord variable is problematic in some cases. You may try using "gSCReq" in place of "gr".  And if you add the 'gs.info();' line I have in my example, you can review in Script Log Statements when you test.