Service Portal - Viewing team tickets

davidreid
Kilo Contributor

In our Service Portal that was developed by a third party, we have a section along the top of the screen with personalised options for the logged in user

find_real_file.png

Clicking on the User name brings up the user record and they can get to the Knowledge base and Service Catalog from this section too. Also, as you can see above, there is a drop down where the user can view their open tickets. What I'd like to do is change this so that the user can also view tickets raised by their team colleagues as well as themselves (each user record has a populated team field - u_team in the sys_user table) - how can I do this?

1 ACCEPTED SOLUTION

antin_s
ServiceNow Employee
ServiceNow Employee

Hi David,



You need to modify 'My Requests' widget's Server script   - http://instancename.service-now.com/sp_config?id=widget_editor&sys_id=f1672671d7301200a9addd173e24d4... as follows.



1. Created a new function to get current user' team.



function getMyTeam(userID){


gs.log(userID);


var user = new GlideRecord('sys_user');


if(user.get(userID))


return user.team;


}



2. Replace the line 'gr.addEncodedQuery('requested_for=javascript:gs.getUserID()');' with the below lines



var myTeam = getMyTeam(gs.getUserID());


gr.addQuery('team', myTeam);




3. Change the line 'var gr = new GlideRecordSecure('sc_request');' to use GlideRecord as below



var gr = new GlideRecord('sc_request');




With all the changes, it would look like this.



find_real_file.png



Hope this helps. Mark the answer as correct/helpful based on impact.



Thanks


Antin


View solution in original post

8 REPLIES 8

antin_s
ServiceNow Employee
ServiceNow Employee

Hi David,



You need to modify 'My Requests' widget's Server script   - http://instancename.service-now.com/sp_config?id=widget_editor&sys_id=f1672671d7301200a9addd173e24d4... as follows.



1. Created a new function to get current user' team.



function getMyTeam(userID){


gs.log(userID);


var user = new GlideRecord('sys_user');


if(user.get(userID))


return user.team;


}



2. Replace the line 'gr.addEncodedQuery('requested_for=javascript:gs.getUserID()');' with the below lines



var myTeam = getMyTeam(gs.getUserID());


gr.addQuery('team', myTeam);




3. Change the line 'var gr = new GlideRecordSecure('sc_request');' to use GlideRecord as below



var gr = new GlideRecord('sc_request');




With all the changes, it would look like this.



find_real_file.png



Hope this helps. Mark the answer as correct/helpful based on impact.



Thanks


Antin


antin_s
ServiceNow Employee
ServiceNow Employee

Hi David,



Did you try what I suggested above? If   the suggestion has answered your questions, can you please mark it as 'correct' to help the community?



Thanks


Antin


Hi Antin,



Apologies for the delayed response, I'm taking what you are using and applying it to a couple of other things at the moment, but I'll make your response as correct as it has been useful to me.



Thank you again



David


antin_s
ServiceNow Employee
ServiceNow Employee

Hi David,'



Glad it works for you. I think you haven't marked the answer as 'Correct' (you have just marked as 'helpful'). Can you please mark it as 'correct' so that it helps other community users looking for similar help?



Thanks


Antin