Count number of checked records from a list

Yahav Mor
Tera Contributor

Hi,

I need to create UI Action on Incident List in SOW that on click will count and save the sys_id's of the records that user checked, for example in this image the user checked 2 records:

 

 

YahavMor_0-1723108341013.png

 

2 REPLIES 2

Rohit99
Mega Sage

Hi @Yahav Mor ,

You may try with the following script in UI action.

 

    function countAllSelectedIncident()
    {
    tblName = g_list.getTableName(); // here you will get the current table name
    selSysIds = g_list.getChecked(); // here you will get checked incident sys ids
    sysIdList = selSysIds.split(','); //here you will get sys id after splitting
    numSel = sysIdList.length; // number of incidents which you selected
    alert("sysid"+sysIdList+"  count"+numSel);  
    }
please find the attached screenshot.


Rohit99_0-1723111421041.png

 

 

Please mark my response as correct and helpful if it helped solved your question.

 

Thanks,

Rohit Suryawanshi

 

Neeraj31
Mega Sage

Hello,

 

You can copy the sys ids of selected records. Create the UI action with below script.

Set Client and List choice option as "true" and set onclick field as "getIDs()".

This UI action will copy the sys IDs in clipboard.

 

function getIDs() {
    var sysIds = g_list.getChecked();
    copyToClipboard(sysIds);
}

 Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!