How to set related list to read-only based on state field value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2015 10:38 AM
Hi,
I had received a request from a client as to set related lists to read-only according to State field value. I planned to just set the ACL for this to work.
I've already asked hi.service-now for assistance, but this requires customization so they advised I post here for help..
But I have a problem on how do I do this if the related list is not exclusive to Change records such as Problems and Incident lists. Is there a way to do this or at least just disable the list editing only when the change record is loaded without affecting any users editing via the Incident table? Also as far as the buttons go, I think it can be hidden via script right?
How would I also apply this if the related list is an m2m list?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2015 01:16 AM
In the list edit access control make use of this to differentiate between the normal list view of the table and related list ...
gs.action.getGlideURI().get('x_referer').toString()
This will return the url containing the table name, if it opened in the list view and will return the url from the parent record, if viewed from related list...
List view of incident will return something like
-incident_list.do?sysparm_query=rfc%3Da8fa0924c0a80a69698969d384a39b49&sysparm_view=
Related incidents related list in a change record
change_request.do?sys_id=a8fa0924c0a80a69698969d384a39b49&sysparm_record_list=active%3Dtrue^ORDERBYDESCnumber&sysparm_record_row=1&sysparm_record_rows=24&sysparm_record_target=change_request
Now use the return value to block the access in related list ...
if(gs.action.getGlideURI().get('x_referer').toString().indexOf('change_request') > -1)
{
answer = false; //access in related list is blocked
}
else
{
answer = true; //access in normal list edit is allowed
}
Change the script as per your need
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2015 01:08 AM
Hi Kalai,
Will try this.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2023 01:10 PM
Hello @rafaelvd I know this is very old, but did the answer above lead you to a solution? I am tasked with restricting a list edit to a few columns after a related list(s) parent field is not empty. Trying to identify the best approach without being overly aggressive.