how to remove priority and impact choice list if user is not part of a group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2024 02:16 AM
Hi
I have a user requirement here to hide p1 and p2 incidents if a user is not part of the major incident group. Not everyone should submit a p1 and p2.
How do i go about resolving this?
Regards
Ca
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2024 02:44 AM
Hi @Carol2 ,
Create script include and check if user is part of major incident group return true or false form script include to client script. In client script hide choices for impact and urgency.
Refer below link for more info:
https://www.servicenow.com/community/developer-forum/hide-choice-on-incident-form-for-some-users/td-...
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2024 03:01 AM
@Anand Kumar P I followed the link provided but something doesn't work. the script doesn't hide the priority 1 for example if user doesn't belong to the group. what am i missing?
script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2024 04:00 AM - edited 11-25-2024 04:06 AM
Hi @Carol2 ,
You are missing lot of things in client script and script include leave client script and script include.
Create one new display business rule and paste below code
(function executeRule(current, previous /*null when async*/) {
g_scratchpad.grp = gs.getUser().isMemberOf('App Engine Admins'); change group name form App Engine Admins to your Major incident group name
})(current, previous);
Create onload client script in incident table and paste below code
function onLoad() {
var usr = g_user.getUserID();
if (!g_scratchpad.grp) {
g_form.removeOption("impact", '1');
g_form.removeOption("urgency", '1');
}
}
I tried in my PDI working as expected. All code which i pasted is same just you have to replace with your group name in display BR.
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2024 05:33 AM