Restricting user by role to a specific view is not working

SC10
Kilo Guru

I am using the following Business Rule Restrict Form Views by Role - ServiceNow Wiki to restrict users without the ITIL role, to globally be restricted to only views that are "ess".

The issue is that it is not working...

Looking through the script, the last function is calling the main function, but I do not see this last function actually being called anywhere in the script (function sys_user_listGetViewName()). Is this why it is not working?

Just would like to get some help troubleshooting this script, as I am testing with a user who has a single role that is not ITIL. and the view is still going to the default view instead of the ess view.

Thanks.

1 ACCEPTED SOLUTION

Though this rule is global, you have to make modifications for each table that you want to force the ESS view. This one is on the sys_user_list. So in demo013, i gave Zan Sulikowski the user_admin role so he can see users (no ITIL). Without the rule, he see default view. With rule, he see ESS view.



In the comments of the rule it says: //To use on other tables, replace sys_user with the table name


So for change request table you would change to:


function change_requestGetViewName() {




function change_request_listGetViewName() {


  change_requestGetViewName();



and you've limited non-ITIL to ESS view.


View solution in original post

16 REPLIES 16

What role are you testing with? What table are you using for testing that defaults to the default view?


Ideally I'd want anyone who is not of ITIL role (or admin), to be forced to my ESS view. This would apply globally, so I have set table to "Global".


Though this rule is global, you have to make modifications for each table that you want to force the ESS view. This one is on the sys_user_list. So in demo013, i gave Zan Sulikowski the user_admin role so he can see users (no ITIL). Without the rule, he see default view. With rule, he see ESS view.



In the comments of the rule it says: //To use on other tables, replace sys_user with the table name


So for change request table you would change to:


function change_requestGetViewName() {




function change_request_listGetViewName() {


  change_requestGetViewName();



and you've limited non-ITIL to ESS view.


That did it, thanks!



I was not aware that x_listGetViewName() was already a function being used by tables that could be called upon.


Hi,



Juat a clarification.. How did the final global business rule looks like for this requirement.



Can you please put it here. I have also got the same kind of requirement.



Regards


Param