- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2024 01:38 AM
Hi,
I have a list type field over sys_user table. I want to filter it so that it will show users with same company name as logged in user . below not working.
javascript:'company='+gs.getUserID().company;
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2024 02:08 AM
Hi @Rosy14
Do you have the company set for the currently logged in user ? If you have recently set it up, you should logout and login again for gs.getUser().getCompanyID() to work. Refer below snips where it is working as expected for me :
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2024 02:17 AM - edited ‎02-29-2024 02:20 AM
Hi @Rosy14 ,
Try the below code but the catch here is you need to logout and then log in and retest as this is querying company field
javascript:"company="+gs.getUser().getCompanyID();
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2024 01:44 AM - edited ‎02-29-2024 01:47 AM
The getUserID() method on GlideSystem returns a string, so it doesn't have a .company property. Instead, use gs.getUser().getCompanyID(); (using the javascript: prefix):
'company='+gs.getUser().getCompanyID();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2024 01:50 AM
it is not working. tried.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2024 02:09 AM - edited ‎02-29-2024 02:10 AM
Can you explain what you mean by "not working" a bit more please - What it's doing instead? Is the dropdown not showing anything?
Also keep in mind that if you don't have a company set and recently set one on the user profile you're testing with, you may need to log in/out again to refresh your session.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2024 01:47 AM
Hi @Rosy14
Let's try the getCompanyID() to retrieve the current user's company sys_id.
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2024 01:52 AM
It is a list type field btw.