- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018 12:17 PM
Hello,
I want logged in user in my service portal to be able to see records from custom table if the customer name matches theirs. I added a simple list widget to my homepage and under the filter field I wrote this:
customer_name=javascript:gs.getUserID().
Is this correct? When I try applying this filter on the table in my instance the filter comes up as customer_name=(empty).
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018 12:34 PM
You know what I can think of a few issues might be the case,
First you gotta determine where is the filter being applied, on server side or on client side.
On server side gs.getUserID() is what you want, but that needs to be applied before query.
On the client side get user ID is a different framework, it's definitly not gs.getUserID(), i forgot off top my head the syntax.
Also you said this is a widget so you can take a look at the widget itself and determine if the filter is server side or client side.
Edit:
Quick googling tells me client side is actually g_user.userID
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018 12:28 PM
gs. getUserID() returns the user's record sys_id
so if your customer_name returns the name of the user, it's no good.
It must be the reference field that contains the sys_id, and always use sys_id.toString() or getValue("u_user_reference") otherwise you might get an object that is not string so the comparison always fails.
I haven't tried it directly in the UI filter, but you probably need the javascript:gs.getUserID() to tell the interpreter to evaluate that instead of taking it as a string.
EDIT: never mind you are already using it. Then it suggests the gs object is not defined.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018 12:34 PM
You know what I can think of a few issues might be the case,
First you gotta determine where is the filter being applied, on server side or on client side.
On server side gs.getUserID() is what you want, but that needs to be applied before query.
On the client side get user ID is a different framework, it's definitly not gs.getUserID(), i forgot off top my head the syntax.
Also you said this is a widget so you can take a look at the widget itself and determine if the filter is server side or client side.
Edit:
Quick googling tells me client side is actually g_user.userID
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018 01:31 PM
Ohhhh that makes a lot of sense! Thank you very much 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018 02:26 PM
😄 you are welcome