Default view for non itil users

Not applicable

I have a group that is not a part of IT that needs to use the system, enter incidents, etc. We want them to be able to behave as if they were IT, view other incidents in the system, and allow other groups to assign to them.

What I have done is created a group to put them in and a role for that group. I have given that role access to the service desk application and modules that allow them to view tasks assigned to them, assigned to their group, etc. The problem I am having is when I create a module that will allow them to enter a new incident record, they get the ess view and not the default view that I want them to have. I have checked the module and it does not have a view associated with it, although I tried to create a view for them that is a copy of the default view but that didn't work... it just defaulted back to ess view.

I think I saw an article somewhere that will allow me to assign tickets to them, but how do I change the views away from the ess view for non itil users without giving them the itil role?

17 REPLIES 17

Not applicable

while browsing around for other things I stumbled across this excerpt in another thread
[QUOTE] take a look at the "incident functions" business rule. There's a global function there called function incidentGetViewName(). This intercepts the view a person is _going_ to see, and gives you the opportunity to change it. This is useful if the default behavior is not to your liking. You can use this function to determine what view a person sees for Incidents. If you want you can make it so that ess_admin users _always_ get the ess_admin view if it exists. To do this, you could add the following if statement to that function:

if ((gs.hasRole("ess_admin")) && (!gs.hasRole("admin"))) {
answer = "ess_admin";
return;
}[/QUOTE]
And then I found this... [QUOTE]gs.hasRole('itil_incident') || gs.hasRole('itil_problem')[/QUOTE]
in this wiki article...http://wiki.service-now.com/index.php?title=UI_Actions

So what I did was find the business rule named "incident functions" and the function named "incidentGetViewName()"
and instead of the line... "if (gs.hasRole("itil"))"
I put "if ((gs.hasRole("itil")) || (gs.hasRole('itil_problem')))"

so the whole function reads like this.

[QUOTE]function incidentGetViewName() {
if ((gs.hasRole("itil")) || (gs.hasRole('itil_problem')))
return;
if (view.startsWith("ess"))
return;

answer = "ess";
}[/QUOTE]

Problem is... when I do a check on the js with the little icon, it comes up with a litany of errors, but not all of them were related to my portion of the script, so I had a suspicion that those errors would show even without my script modifications and I was right.

Here are the errors:

[QUOTE]Error:

Problem at line 6 character 6: Missing '{' before 'return'.

return;

Problem at line 8 character 6: Missing '{' before 'return'.

return;

Problem at line 22 character 4: Missing '{' before 'return'.

return null;

Problem at line 45 character 3: Missing '{' before 'return'.

return;

Problem at line 53 character 3: Missing '{' before 'uri'.

uri += "&sysparm_view=" + viewName;

Problem at line 85 character 6: Missing '{' before 'emailAddress'.

emailAddress = user.email;[/QUOTE]

If I try to make my modifications, the errors prevent me from committing the changes. I don't know enough about js to attempt to correct the syntax, so I couldn't even pretend to know what to do with it. Since this rule functions without my changes, I assume I could commit my changes without harm if I could somehow force the system to take it. So what do I do about this?


Not applicable

There's actually some problem here that SNC should look into - I just opened that Biz Rule in our test instance, made no modifications, and ran the script checker. It gives these errors, with no changes made by me:


Problem at line 6 character 6: Missing '{' before 'return'.
return;
Problem at line 8 character 6: Missing '{' before 'return'.
return;
Problem at line 15 character 2: Expected to see a statement and instead saw a block.
if ((gs.hasRole("ess_admin")) && (!gs.hasRole("admin"))) {


You can get past the checker errors for the first two by wrapping the "return;" in lines 6 and 8 with curly braces. Although, the checker shouldn't be erroring there - single-line statements don't need to be enclosed like that.

I have no idea why it's complaining about line 15 though. And I don't know why you're seeing more errors than I am, have you made other modifications to this Biz Rule in the past?


Not applicable

I have not made any modifications to this business rule until now.

Regarding the script check errors:
On a hunch I tried first checking the script and then saving the business rule, and I was able to save. Now I just have to figure out why I can't see the "opened" field and why I can't modify impact and urgency.


The javascript syntax checker follows strict standards so it will complain about single line if statements without braces, but it will save and execute.
As for the opened, impact, and urgency fields, it's probably security related. Is there a reason this other group cannot have the itil role?