How do get items selected in a List Choice UI Action?

richard38
Tera Guru

Good morning community,

I'm trying to get information from a List to process using a UI Action. I've tried different options to no avail. My problem is not that the system doesn't see the items - it does and even shows all of the checked items in the infoMessage. My problem is that it doesn't remember the items. It shows the record then goes back to the top and shows the next record (never gets past line 15). I've tried to push them an array or push them into a temp table and I only get the first record. I don't know what it's doing so using a while/for condition isn't really helpful unless there is something that I'm missing in the background because it seems to be looping through the selected records.

Here is what I have:

ui action code.png

3 REPLIES 3

paramveer
Mega Guru

Hi Richard,



Is your UI action is client checked(there should be a client check-box). If UI action is not client side, then you can not write alert() in UI action.



If you want to show any alert message then, please make UI action client side by checking the client. Now the problem is if UI action is client checked you can not use server side API(like gs.addInfoMessge). So please use either client side coding or serve side.



If you want to use both client as well as server side scripting, then use gsftpSubmit.



visit below link :



ServiceNow KB: Determine if the UI action is configured correctly (KB0547282)



Thanks,


Param


Thanks Param. It's not a client side action. I've actually changed it to use addInfoMessage, but the biggest problem is that is the code seems to loop starting at line 15 and will only output records one at a time via addInfoMessage.


paramveer
Mega Guru

g_list, g_checked are client side, you can not use these in server side actions.