Usecase related to incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
Display a list of incidents as per logged in user's location with incident location.
I have trying this use case in query business rule , but it not getting desired output as expected.
I have tried Background script in that its working fine but in incident table its not working.
var userLocation = gs.getUser().getLocation();
if (!userLocation) return;
current.addQuery('location', userLocation);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hello @Pratik232 ,
I have tried using this code . It will working in that .
Here's is the code .
if my response is helpfull please mark it as helpfull,🙏 and accept as a solution👍
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Remember there is already 1 OOTB query BR on incident table
If you are doing this for learning purpose then your query BR is correct
Please disable the OOTB one and then test
💡 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
yesterday
Hello @Pratik232 ,
Try This before Query Business Rule Code snippet :
(function executeRule(current, previous /*null when async*/ ) {
var ga = new GlideRecord('sys_user');
if (ga.get(gs.getUserID())) {
current.addQuery('location', ga.location);
current.query();
}
})(current, previous);
If this helps you then mark it as helpful and accept as solution.
Regards,
Aditya,
technical Consultant
