Create ACLs based on views

ShAn21
Tera Guru

Hi,

Is it possible to create ACL based on views? I have view on list view where I want to restrict editing a field. But I do not want it to impact other views? Can someone tell how can we we achieve this?

Regards

14 REPLIES 14

Yes, that is correct. If it is list ACL, then there is no need of indexOf(). It should only check for the view via gs.action.getGlideURI().get('sysparm_view') or RP.getParameterValue('sysparm_view'). 

Hi Muhammad

gs.action.getGlideURI().get('sysparm_view') returns null for me.

@ShAn21 

Try this

var answer = true;
if (gs.action.getGlideURI().getMap().get('x_referer').indexOf('sysparm_view=<backend_view_name>') >= 0){
          answer = false;

It kind of  works. However like in my last message if I open incident list from a menu there is no sysparam_view in the url. So therefor the ACL does not work. Example below when going to incident > Assigned to Me

https://<instance_name>.service-now.com/nav_to.do?uri=%2Fincident_list.do%3Fsysparm_userpref_module%3D283b6424c611228501ffeaea1e115220%26sysparm_query%3Dactive%253Dtrue%255Eassigned_to%253Djavascript%253AgetMyAssignments%2528%2529%255EEQ%26active%3Dtrue%5Eassigned_to%3Djavascript&colon;gs.user_id()%26sysparm_clear_stack%3Dtrue

Brian Lancaster
Tera Sage

I have noticed a couple things.

  1. To use gs.action.getGlideURI() you must do it like this otherwise you get null. gs.getProperty("glide.servlet.uri") + gs.action.getGlideURI();
  2. This does not seems to work in ACLs.
  3. I tried to do this using a before update business rule. However I found that if you go to the menu Incidents > Open the view is not in the URL unless you refresh the list. So it therefor does not work via a business rule either.

I don't think there is a way to do this without making this impact other views. I'm not sure I understand what your are trying to get out of this. Since the user could just change the view they are on.