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.

Request description need to populated from RITM description

Rakesh11
Tera Contributor

I have written one BR to populate Request description from RITM description once RITM got created.
Below is the code:

var req = new GlideRecord ('sc_request');
req.addQuery('sys_id',current.request);
req.query();
if(req.next()){
req.description = current.description;
req.update();
}

 

But its not working. The same is working from Background script. Please help

7 REPLIES 7

Thats correct , I am using after insert BR with RITM desc is there

Community Alums
Not applicable

Hello @Rakesh11 ,

 

Try to use async BR, as the REQ record is created after RITM creation.

 

If this solves your query mark this as correct and helpful.

 

Thanks

Anand

 

Hi @Community Alums ,

 

I tried async as well but no luck:

 


var req = new GlideRecord ('sc_request');
req.addQuery('sys_id',current.request);
req.query();
gs.log("description 1234 " + current.request);
if(req.next()){
gs.log("description 1234 " + current.description);
req.description = current.description;
gs.log("Testing ritm 12345 " + req.description);
req.setWorkFlow(false);
req.update();
}

 

it is not going  inside if since sys_id is not getting queries in line 2