Need to call script include in reporting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2019 02:53 AM
Hi All
I have a requirement in which i want to get report of all the cases who's assignment group is part of "report group".
"report group" is a field which i have created in my user form in which we can add n number of groups.
I know we can achieve this using script include then calling that function using java script but that is knot working i dont know why.
i have written below code but this is not working
var getGroup = Class.create();
getGroup.prototype = {
initialize: function() {
},
getreportgroup: function(){
var group ='';
var user = new GlideRecord('sys_user');
user.addQuery('sys_id',current.sys_id);
user.query();
while(user.next()){
group = user.u_report_group.toString();
}
group = 'sys_idIN' + group;
gs.log('testing'+ group);
return group;
},
type: 'getGroup'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2019 03:44 AM
hi,
Please declare the group variable as "var group=[]" an in the while statement write the below code :
while(user.next()){
group.push(user.u_report_group.toString());
}
and return the groups like as "return 'sys_idIN' + group"
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2019 10:30 AM
The "report_group" is a field of "sys_user" table?
If yes, you can try this:
Objective: Display the number of cases by assignment group (member of report_group field)
Filter for the report
assignment_group javascript:getReportGroup()
Find ArrayUtil Script Include and set to Client Callable
Script Include: ArrayUtil
Client Callable: true
Add getReportGroup Script Include
Script Include: getReportGroup
Client Callable: true
Description: Returns all report groups of your current user
function getReportGroup(){
//Set Variables
var myUserObject = gs.getUser();
var myReportGroup = "";
var arrayUtil = new ArrayUtil();
var myrpGR = new GlideRecord(sys_user);
myrpGR.addQuery("sys_id","IN",getUserID());
myrpGR.query();
while(myrpGR.next()){
myReportGroup.push(myrpGR.u_report_group.sys_id.toString());
}
return arrayUtil.unique(myReportGroup);
}