How do i pick rows which are checked in a related list

apaluri
Giga Contributor

Hi

Am trying to build a UI Action where in i need to pick the checked rows in a related list of form( eg pick the rows which are checked in asset related list in a incident form), any insights on if this can be done?

Thanks,

Anirudh

6 REPLIES 6

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Anirudh,



I don't have an instant answer for you. But you can check the OOTB UI action scripts for ex : Delete UI action only deletes the selected record in list view.


I hope this helps.


sachin_namjoshi
Kilo Patron
Kilo Patron

In your UI action, you can use "List Choice" option to capture selected rows in list.



Regards,


Sachin


Ankur Bawiskar
Tera Patron
Tera Patron

Hi Anirudh,



Have a "List choice" UI action and make it client side by clicking the checkbox for client. in onclick field have a method name such as getSelected().


In script section add this script



function getSelected(){


// this gives an array of sys_ids of the records which are checked and then you can do whatever you want with these sys_ids


var selected = g_list.getChecked().split(',');


alert(selected);


}



This works on normal table also and wherever you are having this table as related list



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


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

Hi Ankur,

How would you do you redirect to service catalog item once you got the sys_ids?  I can't get the redirect to work.  The alert shows me the sys_ids but the redirect does not work.

 

find_real_file.png