- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 03:36 PM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2019 03:53 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 03:41 PM
"eGroup" can't be the column name on the request table. maybe you have a typo in your script? My guess is that eGroup is the variable name, so in that case, try:
req.setValue('x_egroup', current.variables.eGroup);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 03:51 PM
Hey,
I tried that way but unfortunately it didn't work
is it something related to scope application ?
because I believe sc_Request(request) table is on global application and I created the field "x_egroup" on sc_Request(request) table and BR on (sc_req_item) request item table on scoped application.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2019 07:16 PM
Hi @jon Barnes
The below BR worked for me on after and Insert. We were able to copy variable value to Req but two request were getting created One request with RITM and another Request without RITM
(function executeRule(current, previous /*null when async*/) {
var request =current.request.getRefRecord();
request.x_group = current.variables.eGroup;
request.update();
})(current, previous);
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2019 08:47 PM
HI,
Try to change the application on which your variable exists and try below code.Hope it will works.And if you want this for one particular item better to try this code in that particular item workflow.
var req = new GlideRecord('sc_request');
if(req.get(current.request.sys_id)) {
req.eGroup = current.variables.x_egroup;
req.update();
}