Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Custom list view action requirement.

Community Alums
Not applicable

I have this following requirement:

1) In cmdb_ci_business_app tables list view, if anyone selects on or more than one records in the list view and clicks on "Trigger App Criticality&Risk Asmt" ui action from the list choice. I need the following.

1) get sys_ids of all the selected records.

2) Add an info message showing total number of records which were selected.

 

I have created a UI action (client side), to perform this activity. How can I access the sys_ids and add and info message.

 

Screenshot 2025-08-25 at 8.41.40 PM.png

6 REPLIES 6

Community Alums
Not applicable

Hi @RaghavSh 

This did work. I've modified the code as below:

function showSelectedSysIds() {
	alert('check 1');
    var ids = g_list.getChecked();

    var selectedIds = ids.split(',');

    alert("sys_ids are " + ids);
    alert("Length is " + selectedIds.length);
}

 

But g_form.addInfoMessage doesn't work. So I'm using alert for now. But is there a way to show the message in a better way. 

@Community Alums make sense

1. g_form will not work to show message.

2. Alert is the easy option.

3. What you can try is calling a UI page in your UI action and show the details in desired way.

 

refer for UI page : https://www.servicenow.com/community/itsm-forum/code-to-call-ui-page-from-ui-action-button/m-p/517386 


Raghav
MVP 2023
LinkedIn