
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2025 08:53 AM
Hi All,
I have created below View rule and put the logs but its not getting trigger. Is my script is correct ?
Please suggest,
Script:
(function overrideView(view, is_list) {
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2025 03:53 AM
HI @Virendra K
check if there is any unnecessary field populated on the view rule
couple things you can check
- override user preferences should be = true
- check if any condition is added and remove it
- check if any other view rule is overriding your view rule
- if you instance is domain separated check if the change record domain that you are opening and view rule are same domain
- check if your view rule is overriding other view rule
- check any other view rule is acting on and change the order and see
change the gs.log to gs.addErrorMessage or addInfoMessage so that if the view rule runs you'll immediately see the message on the form and you don't have to open the logs to check
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2025 09:02 AM
no log is coming? not even one?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2025 02:54 AM
Hi @Ankur Bawiskar,
Yeah, not a single log is coming. Seems its not getting even getting enter in the scripting part ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2025 03:31 AM
please try to use gs.info() and see
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2025 09:32 AM
Hi @Virendra K ,
you script looks good
just put try catch and see if you see any error
(function overrideView(view, is_list) {
try {
gs.log("VK passed");
var url = gs.action.getGlideURI().getMap(); // I tried with this line
//var url = gs.action.getGlideURI().toString(); // as well as I with this
var sysId = url.get('sys_id');
var catType;
var grChg = new GlideRecord('change_request');
if (grChg.get(sysId)) {
catType = grChg.u_cat_type;
gs.log("VK IF " + sysId + " " + catType);
if (catType == 'XECHG') {
gs.log("VK IF Passed");
var GroupMember = new changeMemUtils().checkNotGrMembership('change_XE_groups');
if (GroupMember) {
gs.log("VK GrMem " + GroupMember);
answer = 'XEChg_View';
return;
}
}
}
} catch (err) {
gs.addErrorMessage(err);
gs.error('VK '+err);
}
})(view, is_list);
is this script include throwing any error?
new changeMemUtils().checkNotGrMembership('change_XE_groups');
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya