Create and assign default view for group on Incidents

Michael M1
Giga Expert

I have a group with several users that require their own view of the INC form. 

Here is what I did so far:

  • created a new role for this group (GMM) 
  • assigned that role to the group
  • created a new System UI --> View called 'GMM'
  • created a View Rule on table = incident as advanced and added code below

    (function overrideView(view, is_list) {
    if (gs.getUser().hasRoles('gmm'))
    answer = "GMM"; // set the new view to answer
    })(view, is_list);

  • When I went to the INC form there was still no view called GMM, so I went to Form Layout and added the view 'GMM'.
  • I impersonated a user in the group and still my default layout was 'Default'

What did I miss?

1 ACCEPTED SOLUTION

Ravi T
Tera Guru

Hi

change the code

 Try this

(function overrideView(view, is_list)

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


answer = "GMM"; // set the new view to answer

return answer;

}
})(view, is_list);

 

 

 

correct it in your code and try

 

 

View solution in original post

2 REPLIES 2

Ravi T
Tera Guru
Hi Michael, Find the link below it will guide you to the solution https://community.servicenow.com/community?id=community_question&sys_id=7957df78dbb85f042d1efb651f9619af Mark it as correct /helpful if it helps you Regards Ravindra

Ravi T
Tera Guru

Hi

change the code

 Try this

(function overrideView(view, is_list)

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


answer = "GMM"; // set the new view to answer

return answer;

}
})(view, is_list);

 

 

 

correct it in your code and try