How to create Dynamic Filter Option for Department

yundlu316
Kilo Guru

Our team wants to create a dynamic filter option that allows a someone to filter a list by the logged-in user's Department.  We tried to follow the ootb Me filter, but couldn't get anything to work.  In the script, we have 

 gs.getUser().getDepartmentID();

We chose field type String...though we tried to choose Reference, but the list of Reference Tables to choose from only had 6 available tables.  We also checked Available for Filter as true.

Any suggestions on how we can get this to work?

1 ACCEPTED SOLUTION

Mike Patel
Tera Sage

I created it and worked fine for me with same script (see below)

Note: If user is logged in and has department like IT and if department is changed to let say HR, it will give IT as value until user logs off and log back in.

find_real_file.png

find_real_file.png

View solution in original post

6 REPLIES 6

Mike Patel
Tera Sage

I created it and worked fine for me with same script (see below)

Note: If user is logged in and has department like IT and if department is changed to let say HR, it will give IT as value until user logs off and log back in.

find_real_file.png

find_real_file.png

Thanks @Mike Patel ! It worked when I switched my scope to Global.

Yes, gs.getUser().getDepartmentID(); doesn't work in scoped app but you can create it in global and call it from scoped app.

Hello,

Sorry for my question but did you need to write   script in order to create the dynamic filter??

I need to filter by department but have no idea on how to write the script.. thanks for your help...

Juliette