- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 06:58 PM
Hi,
I want to get the yellow frame and pass the value to that case.
I have created the following BR. BR seems to be running, but the number is 0 and it seems that the query is not executed well.
Please point out.
BR
(function executeRule(current, previous /*null when async*/ ) {
var task = new GlideRecord('sn_hr_le_case');
task.addQuery('parent', current.sys_id);
task.query();
gs.info(task.getRowCount());
if (task.next()) {
if (current.reject == 'true' || current.reject == true) {
current.approval = 'rejected';
} else {
current.state = 3;
current.variables.ob_confirm_date = task.ob_confirm_date;
current.variables.last_confirm_date = task.last_confirm_date;
current.variables.boss_comment = task.boss_comment;
}
}
})(current, previous);
Thanks in advance,
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 07:11 PM
try changing
task.addQuery('parent', current.sys_id);
to
task.addQuery('sys_id', current.parent.sys_id);
also easiest way is to use below
if (current.reject == 'true' || current.reject == true) {
current.approval = 'rejected';
} else {
current.state = 3;
current.variables.ob_confirm_date =current.parent.ob_confirm_date;
current.variables.last_confirm_date =current.parent.last_confirm_date;
current.variables.boss_comment =current.parent.boss_comment;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 07:11 PM
try changing
task.addQuery('parent', current.sys_id);
to
task.addQuery('sys_id', current.parent.sys_id);
also easiest way is to use below
if (current.reject == 'true' || current.reject == true) {
current.approval = 'rejected';
} else {
current.state = 3;
current.variables.ob_confirm_date =current.parent.ob_confirm_date;
current.variables.last_confirm_date =current.parent.last_confirm_date;
current.variables.boss_comment =current.parent.boss_comment;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 11:34 PM
Hi,
Thank you for your advice.
I worked it!
Regards,