com.glide.script.RhinoEcmaError: "readOnly" is not defined - ERROR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 04:38 AM
When running the below script I am getting an error on the logs:
com.glide.script.RhinoEcmaError: "readOnly" is not defined.
<refname> : Line(1) column(0)
==> 1: readOnly
The code is looping through but the records are not deleted. Appreciate any help with this.
var redactJournal = new GlideRecord('sys_journal_field');
redactJournal.query('element_id', caseGr.sys_id);
redactJournal.query();
while (redactJournal.next()) {
gs.info('Journal 111 updated/deleted');
// redactJournal.setValue('value', 'Data Redacted');
// redactJournal.update();
redactJournal.deleteRecord();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 05:40 AM
Script is not on Global scope, Would this cause an issue deleting journal entries?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 06:10 AM
Did you try adding logs and verify?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 06:20 AM
Hi Ankur,
Where should I put the log statements? The log i have inside the journal entries deletion proves it is looping through as expected but doesn't delete the records. Thanks