Form Views & View rules

Community Alums
Not applicable

Hi I would like non admin/non group members to only have one view on Project, while allowing admin/group members to be able to select other views. How can I achieve this? 

I tried an advanced view rule(shown below and variations of this), this does prevent non admin/non group users from selecting the default view, but they are still able to select the other views such as waterfall/business case view. 
MuAl_0-1669751228352.png

 

 

(function overrideView(view, is_list) {

if (gs.hasRole('admin') || gs.getUser().isMemberOf('PMO IT Admin')) {
answer = 'NULL';
} else {
answer = 'Customer_View';
}
})(view, is_list);

 

 


I have also tried 2 view rules, one that is basic and sets the view, and another advanced with the script above without the else part. This method gets rid of the option to select views for all users including admin. 

3 REPLIES 3

Mohith Devatte
Tera Sage
Tera Sage

Hello @Community Alums ,

Check with the user who is not admin and he not part of that group.

It might be a case where one of the condition is getting satisfied 

Mark my answer correct if this helps you 

Thanks

Darrell F
Mega Sage

This looked correct to me, and I tried a bunch of other ways to get the script to workj as expected to no avail. I then found the KB below. It looks like this is a known issue and will NOT be fixed 😞

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0719228

 

 

IT does look like you can do a custom solution using a client script. You can see that in the workaround at the bottom of the KB.