javascript:getMyGroups() not working in business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2015 06:03 AM
Hi All,
current.addQuery('assignment_group','javascript:getMyGroups()'); is not working, Please let me know what is exactly wrong in this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2015 07:46 AM
In that case he will be able to see only the Incidents opened by/caller is him.But the user wants to see the incidents assigned to his grps as well
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2015 07:52 AM
I don't mean to add the code to that exact line, what I mean is the syntax of that line needs to be followed.
the if part is only dealing with end users, who do not have roles, so part you are adding would be for users with the itil rule (i am assuming otherwise they wouldn't be in assignment groups)
if (!gs.hasRole("itil") && !gs.hasRole("incident") && !gs.hasRole("field_services") && !gs.hasRole("problem") && !gs.hasRole("change") && !gs.hasRole("knowledge") && !gs.hasRole("release_v2_admin") && gs.isInteractive()) {
var u = gs.getUserID();
var qc = current.addQuery("caller_id", u).addOrCondition("opened_by", u).addOrCondition("watch_list", "CONTAINS", u);
gs.print("query restricted to user: " + u);
} else {
//put your code here and make sure you add query is set to
var qc = current.addQuery('assignement_group','IN',gs.getMyGroups());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2015 07:52 AM
Basically user should be able to see all the incidents assigned to his groups as well as opened by/caller is him
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2015 08:00 AM
yes, this will do that. If a user is assigned to a group, they will have at least one of the roles in your if statement (at least they should, that is the intent of this statement, to separate ess users from itil users)
So the first part of the if is used just to allow ess users to see only their tickets.
The else will filter for all itil users, to only allow them to see tickets that are assigned to their groups.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2015 07:43 AM
this will work
current.addQuery('assignment_group',getMyGroups());