How to create a search functionality in service now without using lookup select box
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2017 03:10 AM
Hi All,
I have the following requirement.
I want to replace the select box with a search functionality but not using a "Lookup Select box" variable type.
currently, i make some API call and get a list of VMs and append it to select box as g_form.addOption("vms", name, name); but now since the number of VM's have increased, I want to change the drop-down to search box. I could have achieved it using a Lookup select box provided I have a data coming from a database table, which is not the case.
From this :
I want this :
How do I achieve this ?? and once the above search box is ready, I need to append the result from the rest call.
Any suggestion would be appreciated.
Thanks,
Krishna P
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2017 03:13 AM
Hey Krishna,
You can go ahead and create a macro and add it to form as below
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
Group: <g:ui_reference size="10" name="group" id="group" table="sys_user_group" completer="AJAXTableCompleter" query="active=true" onchange="setUserFilter()"/>
Users: <g:ui_reference name="userRecords" id="userRecords" table="sys_user" completer="AJAXTableCompleter"/>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2017 11:26 PM
Hi,
Do we need to reference a table for the above macro ?? because I see this (table="sys_user_group" ) in your above macro.
Now, I just have the select box as a variable and assigning a value to it using code
g_form.addOption("VMS", name, name)
I just need a search box in place of select box and assign the value as above
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2017 01:40 AM
Hi Krishna,
Your requirement can be fulfill if you use a reference type variable as you said all data coming from a database table.
So just use a reference type variable and provide that table name in the reference. Also just make display = true for the column you want to show in search.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2017 01:48 AM
Hi,
My data is not coming from a database, there is no table I am using here. I am making a rest API call and getting the response. So no table.
I cannot use Lookup Select box, reference etc. Please read the original thread.
Thanks,
Krishna P