'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

Try this...

// populate the default value for the caller
function incidentGetViewName() {
  if (gs.hasRole("INV")) {
     answer = "YOUR_ROLE_NAME_HERE";
     return answer;
  }
  if (gs.hasRole("itil"))
     return; 
  if (view.startsWith("ess"))
     return;
  if (view == "sys_ref_list")
     return;

  answer = "ess";
}

Hi mark,

 

Thank you for your reply.I used this script. It gave the 'new' view of the incident form to all the users

Sorry, this should ask for your view name in the 'answer' variable, not the role name.

// populate the default value for the caller
function incidentGetViewName() {
  if (gs.hasRole("INV")) {
     answer = "YOUR_VIEW_NAME_HERE";
     return answer;
  }
  if (gs.hasRole("itil"))
     return; 
  if (view.startsWith("ess"))
     return;
  if (view == "sys_ref_list")
     return;

  answer = "ess";
}

lucasita
Tera Guru

Hi, Do you know if that happened also for the sc_req_item? it is not working the view rule with the sc_req_item!