How to use "List Choice" in UI Action

Sathwik1
Tera Expert

I want to use "LIST CHOICE" in a UI ACtion effectively..

suppose when I open any table... table.LIST , I will get some list of records... assume that if I select some records. and then If I click on that particular UI Action then I need to get all the selected records in some alert message...

 

based on that I can modify as per my requirement... just I want to know how to access the selected records..

 

@Ankur Bawiskar 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Sathwik1 

you can get the selected records sysId using this

g_list.getChecked()

Based on that you can have your logic

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Sathwik1 

you can get the selected records sysId using this

g_list.getChecked()

Based on that you can have your logic

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Sathwik1
Tera Expert

HI @Ankur Bawiskar 

Thanks for your quick response..

My requirement is to create the records in another table based on the selection.. so before writing gliderecord(in script include) just tried with logs.. somehow it's not working..


Followed like below.. Note: It's a scoped application

 

OnClick : getids()

Script:

function getids() {
var a = g_list.getChecked();
var b = new ABC().XYZ(a);
}

 

Script Include

var ABC = Class.create();
ABC.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
XYZ: function(id){
gs.info("Sathwik Test " +id);
},
type: 'ABC'
});

 

@Ankur Bawiskar can you please help me to understand what was wrong in it..

@Sathwik1 

you should be using GlideAjax as your UI action is client side

this line won't work

var b = new ABC().XYZ(a);

Please use GlideAjax and send the selected sysIds as parameter

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader