Scripted Choice list

Woz
Tera Contributor

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
}

5 REPLIES 5

Ashutosh Munot1
Kilo Patron
Kilo Patron

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

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

Just so I am sure if I am driving the selection off a choice list I can still use current?

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