- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2019 03:33 AM
Hello,
I have a " before query" business rule that displays info message.
Before query business rule configuration is,
When: Display Query
Advanced tab:
var c='Use * to search';
gs.addInfoMessage(c);
The issue is the info message has to be limited only to list view and not to the form view and this message has to be displayed only for a particular table's list view. How do I implement this?
Regards,
Balaji
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2019 06:31 AM
Hi Balaji,
In the script section take the URL of the page and check whether it is form view or list view
script:
var index = gs.action.getGlideURI().toString().indexOf('u_sample_table_list');
if(index == -1){
// it means it is form
}
else{
// it means it is list
}
the above will tell whether the url is for list or form since for list view it would be tablename_list
also I believe you must have written this query business rule on particular table; if not then in script you can check table name also
similarly using the indexOf
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2019 06:31 AM
Hi Balaji,
In the script section take the URL of the page and check whether it is form view or list view
script:
var index = gs.action.getGlideURI().toString().indexOf('u_sample_table_list');
if(index == -1){
// it means it is form
}
else{
// it means it is list
}
the above will tell whether the url is for list or form since for list view it would be tablename_list
also I believe you must have written this query business rule on particular table; if not then in script you can check table name also
similarly using the indexOf
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2019 12:10 PM
That resolved my issue. Thanks for the tip, Ankur.