How do you get the GlideList getChecked() function working on a UI Page?

Gavin2
Tera Contributor

Aim

Currently I'm trying to sort out a UI Page, similar to the task_add_affected_cis UI Page, to be used on the Change Request table. The aim is to allow the user to see a filtered view of CIs that they can then select and add to the Change Request as Affect CIs.

Background

So far I have managed to cobble together a very crude UI Page which contains an iframe showing the cmdb_ci table. I can pass in url parameters to filter this list as desired, however I am currently unable to actually get a list of the selected CIs, which prevents me from going any further with the page functionality.

From what I have found I should be able to make use of the GlideList2 getChecked() function in order to return a list of the sys_ids for and selected items within the list. Currently however I only get errors thrown back, these been either "g_list.getChecked() is not a function" or "g_list.getChecked() is undefined". I have tried defining the g_list variable both directly within the HTML of the UI Page, within script tags as well as within the Client Script field for the page. Neither seems to yield any results other than the two different errors.

If I seemingly pass in an object in order to define the g_list variable as such "var g_list = new GlideList2.get(document.getElementById('configList'));" (tried with and without new) I get the not a function error. If I try to define the variable by providing the name of a table (which seems to be what happens within the task_add_affected_cis UI Page) then I get the undefined error.

Preferred outcome

My hope is that someone on here would be able to provide an example of how to use the getChecked() function working within a UI Page, or failing that point me to some other method that could be used for a similar outcome.

Thanks,

2 REPLIES 2

ananthagowraram
Mega Expert

Hi Gavin,



please give a try with list collector type Feild. Where you can select multiple values from list and can specify filter conditions using reference qualifiers



Regards


Anantha Gowraram


Hello Anantha,



Thank you for your response, however I would currently like to avoid using a List field as (from what I know) it does not allow for multiple selection of items in the same action. Whereas the business has seen the ability to add multiple items in a single action via the task_add_affected_cis UI Page and want this type of functionality.



The List field might make for a viable backup plan if it's not possible to replicate the existing UI Page functionality, so thanks for suggesting it.