Auto populate short Description of Request with short description variable of requested item

Vasilis Anastas
Tera Expert

Hello , I have made a requested item with a var short description. I want when a user writes something in short description and press submit, automatically this short description to populate request's short description. I tried this BR on table requested_itemand works ok, BUT it disappears the requested item. 

 

(function executeRule(current, previous /*null when async*/) {

var req = current.request.getRefRecord();
req.short_description = current.short_description;
req.update();

})(current, previous);

 

 

 

VasilisAnastas_0-1668518899397.png

 

 

VasilisAnastas_1-1668518982987.png

 

as you can see, its empty. normally it should have the requested item. But as long as BR is active, it doesn't show it to me. When BR is not active, Requested item appears normaly.

 

thank u!

 

5 REPLIES 5

Mohith Devatte
Tera Sage
Tera Sage

hello @Vasilis Anastas can you try this script in an after insert business rule on RITM table 

var req = new GlideRecord('sc_req_item');

req.addQuery('sys_id',current.sys_id);

req.query();

if(req.next())

{

req.short_description = current.variables.short_description;

req.update();

}

Hope this helps 

Mark the answer correct if it helps you 

Thanks