- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2025 03:10 AM
Hi,
It is not giving any output to logs. Kindly help.
(function executeRule(current, previous /*null when async*/) {
current.addActiveQuery();
current.addQuery('priority', 1);
current.query();
while(current.next()){
gs.log('The numbers are ' + current.number);
}
})(current, previous);
Regards
Suman P.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2025 03:20 AM
query business rule doesn't have access to field values hence you can't print any field value or can't access it
it's meant only to restrict based on some logic
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2025 03:43 AM
Hi @ServiceNow Use6 ,
If you want to use query BR then just write script like
current.addQuery('priority', 1);
Result
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2025 03:20 AM
query business rule doesn't have access to field values hence you can't print any field value or can't access it
it's meant only to restrict based on some logic
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2025 04:04 AM
Thank You @Ankur Bawiskar,
I didn't know that it will not generate output. I am stupid. It is just filtering and giving the output.
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2025 03:43 AM
Hi @ServiceNow Use6 ,
If you want to use query BR then just write script like
current.addQuery('priority', 1);
Result
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
