report showing cases in my country

Jack62
Giga Guru

Afternoon all

 

I have a requirement, with the HR Agent workspace, to allow HR agents to see tickets logged in their country, so very similar to tickets assigned to my groups. I thought I could use a condition along the lines of assigned to.country is the same as created for.country but the logic is working. any thoughts?

 

Thanks

1 ACCEPTED SOLUTION

Jack62
Giga Guru

Just to round this off we have resolved it. the script was fine however we moved the script include to the global scope as it was originally in the HR case scope. Hopefully this well help anyone who has this issue in the future.

 

Jack

View solution in original post

2 REPLIES 2

Jack62
Giga Guru

Just to add to this, we have created a script include which the report is pulling and the logs show it is working as expected but no records show in the report (yes, records exist that should show) script included below. 

 

function hrCasePerCountry() {
 
var cases = [];
var count = 0;

var user = gs.getUserID();
var usr = new GlideRecord('sys_user');
usr.addQuery('sys_id', user);
usr.query();
while(usr.next()) {

var country = usr.country;

var ast = new GlideRecord('sn_hr_core_case');
ast.addQuery('opened_for.country', country);
ast.query();
while(ast.next()) {
   count = count + 1;
cases.push(ast.sys_id.toString());
}
}
gs.info('assass' + count + cases);

   return cases;

}

Jack62
Giga Guru

Just to round this off we have resolved it. the script was fine however we moved the script include to the global scope as it was originally in the HR case scope. Hopefully this well help anyone who has this issue in the future.

 

Jack