Restrict View Changes for 'View_changer' Role on Requestor Table

Khalid9030
Tera Contributor

Hello,

 

We want to prevent users with the "View_changer" role from changing the view on the Requestor table—both at the form level and list level—without affecting other tables. However, Admin users should be exempt from this restriction.

 

How can we do this requirement please assist me. 

 

Thanks in advance 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Khalid9030 

I don't think this is possible.

If they have view_changer then they can switch views

Why not enforce view rules and they will see always particular view and then they can't switch the views also?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

8 REPLIES 8

@Khalid9030 

they should not be able to see other views when they right click

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 

I have implemented a View Rule for the view_changer role. When I impersonate a user with the view_changer role, they are able to see the requestor_details_view by default. However, they are also able to switch to other views, but they cannot access the default view. Could you please suggest what the issue might be?

 

View rule code 

(function overrideView(view, is_list) {

    // Add your code here

    if(gs.hasRole('view_changer') && !gs.hasRole('admin')){
       
    answer = 'requestor_details_view' ;  // set the new view to answer
    }
    else{

        answer = view;
    }

})(view, is_list);

@Khalid9030 

weird

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader