Create an ACL to restrict listview edit on specific value

Jamy1
Tera Guru

In the Incident table's listview, I would like to prevent users from changing to "Resolved" state. See below for screenshot:

find_real_file.png

This should only happen if "Field_X" on the Incident table is true. Otherwise, permission is granted to select any of the state fields from the listview, including "Resolved".

If "Field_X" is true, every value in this field should be able to be changed except for "Resolved".

I'm unable to figure out a way to do this. Every time I try to set an ACL, it blocks the entire field (cannot choose/change any values). Is this possible to do with an ACL or a script (business rule, script include, etc)?

1 ACCEPTED SOLUTION

You can Use  current.setAbortAction(true) to abort transaction in business rule.

https://docs.servicenow.com/bundle/newyork-application-development/page/script/business-rules/concept/c_AbortingADbActionInABusinessRule.html

var ciname=current.name;

  var gr=new GlideRecord('cmdb_ci');

  gr.addQuery('name',ciname);

  gr.query();

  while(gr.next())

  {

  gs.addErrorMessage('Record already present');

  current.setAbortAction(true);

  }

 

Regards,

Sachin

 

 

View solution in original post

4 REPLIES 4

sachin_namjoshi
Kilo Patron
Kilo Patron

You can configure business on change of state values and provide user friendly message to user.

This way it will work on both form and list views.

 

Regards,

Sachin

Hi thank you for the response!

How does that stop the user from making a change? Can you provide an example? I understand a message is nice but I'm hoping for something that prevents.

You can Use  current.setAbortAction(true) to abort transaction in business rule.

https://docs.servicenow.com/bundle/newyork-application-development/page/script/business-rules/concept/c_AbortingADbActionInABusinessRule.html

var ciname=current.name;

  var gr=new GlideRecord('cmdb_ci');

  gr.addQuery('name',ciname);

  gr.query();

  while(gr.next())

  {

  gs.addErrorMessage('Record already present');

  current.setAbortAction(true);

  }

 

Regards,

Sachin

 

 

MrMuhammad
Giga Sage

Hi,

If you want to make the field read-only only in the list-view then you need to configure the ACL of type list-edit. See the below screenshot for reference. Admin override must be false if you even don't want admins to change that.

find_real_file.png

Hope that helps!

Thanks,

Muhammad

Regards,
Muhammad