'View Rule' not working

nehasr1288
Tera Expert

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:

find_real_file.png

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

 

8 REPLIES 8

Mark Stanger
Giga Sage

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.

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";
}

 

 

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.

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;
}

}