- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2016 07:02 AM
Hi All,
I'm trying to hide "Edit" in the change task related list by using advance script in list control for people without change_manager role and also there is an OR condition with respect to state.
Please review my code,
var answer;
if(gs.hasRole == "change_manager" ) || (parent.state=='3' || parent.state=='4' || parent.state=='-2' || parent.state=='-13' || parent.state=='-14' || parent.state=='2' || !parent.active;)
{
answer=false;
}
else{
answer=true;
}
But what happens is the EDIT button is not visible to anyone with any role except ADMIN i even revoked all changes but the EDIT button is missing from the related list.
But NEW button is visible to Users
Can someone help me debug this issue.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2016 09:24 AM
The change_task table should be editable to the user. Make sure the MPI
Change Manager has write access to the table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2016 07:51 AM
When you reverted, did your Edit button appear before you started attempting to use ACLs? I thought you were still having issues.
(from the original message)
i even revoked all changes but the EDIT button is missing from the related list
I may have missed an update where you got it working again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2016 07:56 AM
The issue seems to be there for quite sometime .
Even before i made changes to List control i have not seen EDIT button for non admin users and also i confirmed with users that the EDIT button is missing for them for long time.
Only NEW button is visible to NON ADMIN users and where ADMIN has new and edit button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2016 07:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2016 07:57 AM
Hello Sajin,
Now, your issue is more clear than before.
1. The 'Edit...' UI Action in the related list is meant to update the change task record. Now, we cannot use an ACL to restrict write rule for change_task table, as we do not know which change Task is going to be linked with the change record. So, ACL is out of the picture.
2. The best way to restrict this is by adding an 'omit edit condition' to the List Control.
Refer Configuring Lists - ServiceNow Wiki to see examples. or look at other List Controls for working examples.
You Edit condition should be something like this:
People without change manager role: !gs.hasRole('change_manager')
Conditions related to state: parent.state == '4' || parent.state == '2' ... etc
final condition should look like this:
Code:
var answer;
if(gs.hasRole("change_manager") || parent.state=='3' || parent.state=='4' || parent.state=='-2' || parent.state=='-13' || parent.state=='-14' || parent.state=='2' || !parent.active){
answer = false;
} else {
answer = true;
}
answer;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2016 08:08 AM
Thanks for the detailed info .
What ever condition you have mentioned is true but for some reason when i impersonate as a user with MPI change Manager role i don't find the EDIT button on the related list.
if(gs.hasRole("MPl Change Manager") || parent.state=='3' || parent.state=='4' || parent.state=='-2' || parent.state=='-13' || parent.state=='-14' || parent.state=='2' || !parent.active){
answer = false;
} else {
answer = true;
}