Add info message to top of list view using Before Query Business Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2025 07:04 AM
I have a Before Query business rule that adds an info message to a list view.
I am running into an issue when the list view query uses "GROUPBY", the query seems to run twice and display the message twice.
Is there a workaround to this? Or a different way to add an info message to the top of a list view?
Code:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2025 07:12 AM
Use the session variable to check whether you have displayed the Info message already, refer to the below code
Please Mark it helpful
Regards
Priyatam.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2025 07:21 AM
Hello @ChadLee4
Please add another condition that if the query contains Group by it should be skipped -
var _strCurrentURL = (gs.action.getGlideURI() || "").toString();
if (_strCurrentURL.contains("_list.do") && !_strCurrentURL.contains("GROUPBY")) {
gs.addInfoMessage("Info Message");
}
This should work, because the BR is already executing once so It won't execute next time when groupBy is done.
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2025 07:28 AM
Thank you for the response -- That makes the message to not display at all when a GroupBy list query is run.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2025 07:40 AM
Hello @ChadLee4
That's a simple tweak, you can add another line
current.addQuery('sys_id' , '!=', '0');
This will make the query run again and that too without group by. And it will not modify anything. Or even you can take the existing query and add encoded query.
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY