- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2024 03:38 AM
I have a requirement with respect to Service Catalog. Could someone please assist me with this.
There are 2 fields - Location and User, where both are reference fields.
When we select Location as India in Location field, in User field particular user must be not visible. (Example: Abel Tuter must not be visible when we select Location as India)
Thankyou.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2024 03:42 AM
what's your business requirement here?
you can use advanced reference qualifier on User variable
Do you want to remove only 1 user when Location is India?
OR
this is for other locations also
If only for 1 then do this
javascript: var query = ''; if(current.variables.location.name == 'India') query='sys_id!=AbelUserSysId'; query;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2024 04:19 AM
Hello @RakshithaM
I believe that for location field you are referring to core_country table and for user field you are referring to sys_user table .
Now when configuring the reference field for user add the reference qualifier as follows:
javascript:current.variables.location=="8938b7111b121100763d91eebc0713ec" ? "active=true^sys_id!=5137153cc611227c000bbd1bd8cd2005" : "active=true";
8938b7111b121100763d91eebc0713ec : sys_id of location (India)
5137153cc611227c000bbd1bd8cd2005: sys_id of user(Eg: Abel Tutor)
Adding screenshot for better understanding:
Note: Please adjust the sys_id as per your requirement.
Hope this Helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2024 01:01 AM
it should be combined as this
javascript: var query = ''; if(current.variables.location.name == 'India') query='sys_id!=27d3f35cc0a8000b001df42d019a418f'; query = query + '^nameINBlackberry,Bond trading'; query;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2024 03:42 AM
what's your business requirement here?
you can use advanced reference qualifier on User variable
Do you want to remove only 1 user when Location is India?
OR
this is for other locations also
If only for 1 then do this
javascript: var query = ''; if(current.variables.location.name == 'India') query='sys_id!=AbelUserSysId'; query;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2024 04:12 AM
Yes, it's only for one specific user. Want to hide one particular user on selection of location as India.
In User variable reference qualifier, have filled with above code, but still it's not working as per required.
Business requirement:
There are 2 fields in service catalog, both of this field type is reference.
1)Location
2)User
On selection of Location as India, one particular user must not be visible. (Example: On selection of Location as India, Abel Tuter user must not be available for selection in User field)
Thankyou.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2024 04:18 AM
did you give correct location name and correct location variable name
Did you give correct sysId of Abel tuter?
if above are correct the ref qualifier should work fine
please share screenshots.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2024 04:36 AM
I believe I answered your question but you marked other response as correct.
Can you explain what didn't work for you?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader