Module only showing current user items

Edwin Fuller
Tera Guru

I need to create a new module/list of records that only displays items from the current logged in users department?

Does anyone know how to accomplish this ask?

Example: I logged into ServiceNow Self Service and click the "My Department Open" button. From there a list of records should appear showing only items related to my department.

Thanks.

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

Create a new module and in the Link type select the list of records, table and then in the conditions put


business_unit is javascript:gs.getUser().getDepartmentID();


View solution in original post

10 REPLIES 10

I created a custom application and within the app there is a field called "Business Unit" which is populated by an on onLoad client script. The script populates the field with the department of he current user logged in (script below). What I'm trying to do now is create a module that shows all items/incidents where the "Business Unit"/ Department is equal to mines. Hope that makes sense



function onLoad() {


    //Type appropriate comment here, and begin script below


    var user= g_form.getReference("requested_for", callBack);


function callBack(user){


g_form.setValue("business_unit",user.department);


}


}


Great observation Abhinay!   I made several assumptions when I gave my advice, and I should have asked the same question to clarify.


In fact, in addition to the clarification of "ticket"   I'll ask 2 more questions of Edwin:




1. When you say "My Department Open",     do you mean that you want all tickets assigned to your department?   Or do you want all tickets opened or requested by members of your department?



2. What do you mean my "department"? and is the membership of this department defined in the Groups table?


Abhinay Erra
Giga Sage

Create a new module and in the Link type select the list of records, table and then in the conditions put


business_unit is javascript:gs.getUser().getDepartmentID();


I tried this route before and it didn't work, but it's working now!! Thanks so much




Abhinay Erra
Giga Sage

Glad you got it working.