
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 07:54 AM
When we Finalize and Observation, we have a business rule that sets values on the newly created issue.
We know the overall business rule is setting values, but with the upgrade to Yokohama, we're seeing where the final value we're setting is not carrying over.
I confirmed the value in the script is correct before the update, but after the update, the value is changed.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var new_issue = new GlideRecord('sn_grc_issue');
new_issue.get(current.confirmed_issue.toString());
if (new_issue) {
new_issue.recommendation = current.explanation;
new_issue.watch_list = current.watch_list;
new_issue.due_date = current.issue_due_date;
new_issue.u_impact = current.u_impact;
new_issue.u_impacted_population = current.u_impacted_population;
if (current.audit_task.sys_class_name == 'sn_audit_control_test') {
new_issue.u_audit_control_testing = current.audit_task.toString();
}
if (current.u_type.getDisplayValue() == 'Compliance') {
new_issue.classification = '1';
} else if (current.u_type.getDisplayValue() == 'Audit') {
new_issue.classification = '3';
}
new_issue.update();
}
})(current, previous);
The only thing I found in the logs is this, but I can't figure out where it's referencing parent variable.
com.glide.script.RhinoEcmaError: "parent" is not defined.
<refname> : Line(1) column(0)
==> 1: parent.top_task
Stack trace:
at <refname>:1
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2025 04:15 AM
seems some other script is getting triggered when record is updated and that is causing this issue
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 08:13 AM
no where in your script you are using parent variable
Are you sure error is from this business rule only?
try this and check log
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var new_issue = new GlideRecord('sn_grc_issue');
if (new_issue.get(current.confirmed_issue.toString())) {
gs.info("Inside IF");
new_issue.recommendation = current.explanation;
new_issue.watch_list = current.watch_list;
new_issue.due_date = current.issue_due_date;
new_issue.u_impact = current.u_impact;
new_issue.u_impacted_population = current.u_impacted_population;
if (current.audit_task.sys_class_name == 'sn_audit_control_test') {
new_issue.u_audit_control_testing = current.audit_task.toString();
}
if (current.u_type.getDisplayValue() == 'Compliance') {
new_issue.classification = '1';
} else if (current.u_type.getDisplayValue() == 'Audit') {
new_issue.classification = '3';
}
new_issue.update();
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 08:49 AM
I added a couple of outputs to see the value.
gs.info("Inside IF");
new_issue.recommendation = current.explanation;
new_issue.watch_list = current.watch_list;
new_issue.due_date = current.issue_due_date;
new_issue.u_impact = current.u_impact;
new_issue.u_impacted_population = current.u_impacted_population;
if (current.audit_task.sys_class_name == 'sn_audit_control_test') {
new_issue.u_audit_control_testing = current.audit_task.toString();
}
if (current.u_type.getDisplayValue() == 'Compliance') {
new_issue.classification = '1';
} else if (current.u_type.getDisplayValue() == 'Audit') {
new_issue.classification = '3';
}
gs.info('Before Update is run: ' + new_issue.classification);
new_issue.update();
gs.info('After Update is run: ' + new_issue.classification);
}
Here's the output.
*** Script: Inside IF
*** Script: Before Update is run: 1
Script execution error: Script Identifier: unknown, Error Description: "parent" is not defined., Script ES Level: 180
Evaluator: com.glide.script.RhinoEcmaError: "parent" is not defined.
script : Line(1) column(0)
==> 1: parent.top_task
Stack trace:
at <refname>:1
at null.null.script:24
*** Script: After Update is run: 3
I suspect the error is based on the update method, and you can see how the value changes just before and after the update. Any thoughts on this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2025 04:15 AM
seems some other script is getting triggered when record is updated and that is causing this issue
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader