- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2023 08:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2023 07:03 AM
Hi,
In your addEncodedQuery line, you need to allow some JavaScript there to grab the current object.
The script differs from what you shared in your original post as well...please try to let us know exactly what you are using. With that said, I'm glad my original reply is Helpful as it prompted you to provide screenshots to clarify what is actually going on...
For the adjustment to script see this example:
addEncodedQuery('query_paste_here...document_id='+current.sys_id);
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2023 01:11 PM
Hi,
I'm glad you found an answer that worked for you.
I'd still recommend reviewing my reply as similar suggestions were stated.
I hope at a minimum, it was helpful. Keep in mind that if multiple solutions assisted you, you can accept more than one solution as well 🙂
Take care!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2023 08:54 PM
Did you add gs.info() to check if BR ran?
whether query is working fine?
try this
(function executeRule(current, previous /*null when async*/ ) {
//Checks for any Active approval and aborts the update if active
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('document_id', current.sys_id).addOrCondition('sysapproval', current.sys_id);
gr.addQuery('state', 'requested');
gr.query();
if (gr.hasNext()) {
gs.addInfoMessage("There are open approvals which must be completed before this record can be closed");
current.setAbortAction(true);
}
})(current, previous);
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2024 11:06 AM
when i try this, my record still updates, it does not abort. I do receive the message, but it will still update the record. suggestions?