'View Rule' not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2018 06:08 AM
Hi,
My issue is that I am not able to get the 'view rules' working for incidents.I have done a small script in the 'advanced' section of the view rules:
The system is only enforcing default view .I have split the users into 2 groups based on roles: itil and INV. I want 2 different views of the incident form for the two of them.but it always shows the default view

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2018 06:14 AM
View rules won't work on the Incident table because it uses a different method to enforce the correct view. You'll need to modify the 'incident functions' business rule to send a user to a different view.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2018 06:31 AM
Hi Mark,
Thank you for the reply. All I can think of is below in the incident functions but it does not works:
function incidentGetViewName() {
if (gs.hasRole("itil"))
return;
if (gs.hasRole("INV"))
{
answer='Inav Incident form';
return answer;
}
if (view.startsWith("ess"))
return;
if (view == "sys_ref_list")
return;
answer = "ess";
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2018 06:40 AM
Make sure that your user doesn't also have the 'itil' role. Also make sure that 'inav incident form' is the correct view name. Typically view names don't have spaces (view labels do) so I don't think that's correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2018 07:11 AM
Hi Mark,
I have to give the both the groups as 'itil role'. This is the issue.Apart from ITIL one group has 'INV' and the view should be different for this user.So I just tried the below but it is not working at all.It changed the view for both the groups:
if(gs.hasRole('itil'))
{
if(!(gs.hasRole('INV')))
{
answer = "ess";
return;
}
else if((gs.hasRole('INV')))
{
answer="INV";
return;
}
}