All items from List Choice UI Action

grosch
Mega Expert

I'm setting up a UI Action where I'll only click "List Choice".   It seems like the action is run once per item chosen.   What I'm looking for instead is a way to get all of the items chosen and then pass that complete list over to a UI Page.

Is that possible?

1 ACCEPTED SOLUTION

Ah, my bad. It's available in the UI Action condition, but not the script area.



Try this:


var uri = action.getGlideURI();


var parmID = uri.get('sysparm_checked_items');


View solution in original post

7 REPLIES 7

Valor1
Giga Guru

Scott,


I believe this is available through the RP (RenderProperties) object.



Try the following:


// sysparm_checked_items=46e2fee9a9fe19810049b49dee0daf58,9d385017c611228701d22104cc95c371  


var checkedItems = RP.getParameterValue('sysparm_checked_items') + '';


var checkedItemArr = checkedItems.split(',');


RP is not a valid object in the UI Action script window.


Ah, my bad. It's available in the UI Action condition, but not the script area.



Try this:


var uri = action.getGlideURI();


var parmID = uri.get('sysparm_checked_items');


coryseering
ServiceNow Employee
ServiceNow Employee

Hi Scott,



I am not able to reproduce the "List Choice UI Action called once for every checked item" behavior. I've checked on recent Fuji builds, and in my own instance locally.



Where do you see this behavior?


Can you show us a screenshot of the whole sys_ui_action record, including the script?



In my tests, the function defined for the sys_ui_action gets called once. In that function, you can use g_list.getChecked().toString(); to get a list of the sys_ids of each checked record.



This is the test I'm using:


Screen Shot 2015-09-09 at 5.02.18 PM.png



And the result:


Screen Shot 2015-09-09 at 4.22.24 PM.png



My function got called once, and output 2 lines to the console.