- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 12:22 AM
Hello all,
I have a global BR, which is OOB by ServiceNow name: incident functions, with not conditions band below is the code.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 03:07 AM
you can create script include and necessary functions
But you need to determine from where all the functions from this global business are called
Something like this you can create script include and then invoke it like this
new IncidentFunctions().incidentGetViewName();
var IncidentFunctions = Class.create();
IncidentFunctions.prototype = {
initialize: function() {},
incidentGetViewName: function() {
if (gs.hasRole("itil") || gs.hasRole("sn_incident_read"))
return;
if (view.startsWith("ess"))
return;
if (view == "sys_ref_list")
return;
answer = "ess";
},
incidentGetCaller: function() {
if (gs.hasRole("itil")) {
var action = gs.action;
var table = action.get("sysparm_collection");
if (table != "sys_user")
return null;
var userID = action.get("sysparm_collectionID");
return userID;
}
return gs.getUserID();
},
type: 'IncidentFunctions'
};
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
03-03-2025 03:07 AM
you can create script include and necessary functions
But you need to determine from where all the functions from this global business are called
Something like this you can create script include and then invoke it like this
new IncidentFunctions().incidentGetViewName();
var IncidentFunctions = Class.create();
IncidentFunctions.prototype = {
initialize: function() {},
incidentGetViewName: function() {
if (gs.hasRole("itil") || gs.hasRole("sn_incident_read"))
return;
if (view.startsWith("ess"))
return;
if (view == "sys_ref_list")
return;
answer = "ess";
},
incidentGetCaller: function() {
if (gs.hasRole("itil")) {
var action = gs.action;
var table = action.get("sysparm_collection");
if (table != "sys_user")
return null;
var userID = action.get("sysparm_collectionID");
return userID;
}
return gs.getUserID();
},
type: 'IncidentFunctions'
};
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
03-03-2025 03:09 AM
Ideally this is OOB business rule so you should also check with ServiceNow why they have created it if it's not best practice.
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