How to copy the variables from RITM(sc_req_item) to Request "Req"(sc_request)

Service Manager
Kilo Guru

Hi All,

I would like to copy one of the variable "Egroup" (single line text) from RITM table to Req table

I wrote Business Rule On after Insert and specified the catalog item in filter condition

(function() {

//get the gliderecord for the parent request

var req = new GlideRecord('sc_request');
if (req.get(current.request)) {
req.eGroup = current.variables.x_egroup;
gs.addInfoMessage("Hello World");
req.update();
}
})();

FYI : I created BR on scoped application and a new field egroup on sc_request(request) table as a scoped field.

 

Thanks

1 ACCEPTED SOLUTION

Actually 
I tried that on global application and it worked successfully with below script 

BR async 

 

(function executeRule(current, previous /*null when async*/) {
var request =current.request.getRefRecord();
request.x_egroup = current.variables.egroup;

request.update();

})(current, previous);

 


Thanks

View solution in original post

5 REPLIES 5

Actually 
I tried that on global application and it worked successfully with below script 

BR async 

 

(function executeRule(current, previous /*null when async*/) {
var request =current.request.getRefRecord();
request.x_egroup = current.variables.egroup;

request.update();

})(current, previous);

 


Thanks