View Rules - Default View Setup for a Specific Role

Elizabeth26
Tera Contributor

I'd like to setup a view rule for the default view for just one particular role.

If the user has X role they will get the default view.

Is there an easy way to do this?

9 REPLIES 9

Darrell F
Mega Sage

You can do this with a view rule.  You can use an advanced script to look at user role. 

Something like:

 

  if (gs.hasRole('RoleA')) 
         {

            answer = "ViewA";

I am not sure what I am doing wrong. It's not working.

I am not sure if it's the dot in the role name or do I need an underscore in the view? I've tried both. 

 

Role Name: x_scope.manager (the role name contains a . should it be a . or _?)

View: Default View

 

(function overrideView(view, is_list) {

// Add your code here

if (gs.hasRole('x_scope.manager')){
answer = "default view";}


})(view, is_list);

I put this in my PDI using the same script and role and it works without issue. Are you sure the person you are impersinating has the role?