How to specify dictionary attributes on reference field in HTML?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2024 10:31 PM
Hi
I have created a customized field called 'Manager' on review_request UI page for Exception request. It is a reference field that refers to the User [sys_user] table. I want to add the searching capability on that field based on User ID, first name and last name.
If it would have been a field on a table, I would have used dictionary attribute: ref_ac_columns=user_name;first_name;last_name,ref_ac_columns_search=true.
But since this is a field created in HTML code, how to add these attributes? I tried it like one would add other attributes normally. But it didn't work.
Thank you in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2024 11:34 PM
Hi @ArpitaVK
Please use the below line of code to achieve this. Do replace your attribute field name, table name etc as per your configurations:
<g:ui_reference name="user" completer="AJAXTableCompleter" id="user_name" table="sys_user" columns="user_name;manager;phone;location"/>
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2024 12:46 AM
Hi @shloke04 ,
Thanks for your reply. The solution works up to some extent. For the same reference field, I have added query attribute to filter the users which are active=true and have ITIL role. But when I search for some user, it shows me all other users matching that search as well. The default filter it is taking as Name starts with.... for first name search and Name contains..... for last name search. If I enter User ID (it's a combination of letters and numbers in given records), it searches in Name and says that 'No records to display'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2024 01:04 AM
Hi @ArpitaVK ,
You can refer the below article ,
https://www.servicenow.com/community/developer-forum/ui-reference-how-to-use-the-record/m-p/1415664
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang