Need help on business rule, to not run on portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2024 07:50 PM
Hello All,
I have business rule to restrict users from creating incident who are not part of those 4 groups.
It basically check if loggedin user is part of those 4 groups , if not then it will show info message and stops it from creating incident . But my issue here is we have record producer in portal which has those assignment group, this business rule shouldn't run on portal. It should allow any user to create the incident for those groups.
How can I achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2024 05:56 AM
Try one of these if conditions to only execute the Business Rule script in the native UI.
(function executeRule(current, previous /*null when async*/ ) {
if (gs.action.getGlideURI().toString().indexOf('sp') == -1) { //not Service Portal
var currentUser = gs.getUser();
var isServiceDeskUser = currentUser.isMemberOf('Tech Supp') || currentUser.isMemberOf('Irv Tech Supp') || currentUser.isMemberOf('Lou Tech Supp') || currentUser.isMemberOf('IT Service Desk');
if (!isServiceDeskUser) {
// Abort the action and add an error message
current.setAbortAction(true);
gs.addErrorMessage('Only Service Desk and Level 2 group members may Create or Update this Incident.');
}
}
})(current, previous);
(function executeRule(current, previous /*null when async*/ ) {
if (GlideTransaction.get().getRequest().getHeader("referer").indexOf('esc') == -1) { //not Service Portal
var currentUser = gs.getUser();
var isServiceDeskUser = currentUser.isMemberOf('Tech Supp') || currentUser.isMemberOf('Irv Tech Supp') || currentUser.isMemberOf('Lou Tech Supp') || currentUser.isMemberOf('IT Service Desk');
if (!isServiceDeskUser) {
// Abort the action and add an error message
current.setAbortAction(true);
gs.addErrorMessage('Only Service Desk and Level 2 group members may Create or Update this Incident.');
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2024 06:16 AM
I tried it, but still I am getting same error message