Scripted Choice list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2018 02:35 AM
Hello,
I have a script seen below to return values from a table. I want to use this script to create a choice list. Where do I need to put the script (Its a client callable script include)
function bsFilter(bsCategory,bsCatalogue){
var lookup,
list = [],
returnString;
lookup = new GlideRecord("my_table");
lookup.addQuery("my_table",bsCategory);
lookup.addQuery("my_table",bsCatalogue);
while(lookup.next()){
list.push(lookup.getUniqueValue());
}
returnString = "sys_idIN"+list.join(',');
return returnString
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2018 02:38 AM
HI,
You have to create a client script which will call this script include and the choices which you want to add should be passed from this script include and then you can g_form.addOption in client script.
Thanks,
Ashutosh munot

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2018 03:09 AM
HI,
Oh yes if this is related to reference field then use advance reference qualifiers.
and call script include as below:
javascript:scriptincludename().functionname(current.category,current.subcategory);
Thanks,
Ashutosh Munot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2018 04:43 AM
Just so I am sure if I am driving the selection off a choice list I can still use current?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2018 04:53 AM
Hi,
Yes in script include function you can use this values. So on current form if you have category and subcategory then you can pass.
Thanks,
Ashutosh Munot