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.

UX client script is not working on all records

Alekhya Anaveni
Tera Contributor

Hello, I have UX action to make changes on a field through UX client script for selected records in the table list in UI builder workspace, it is working when I select records on current page and select records through select all records check box, but it is not triggering when I select all records in the list through "select all records" option.

function handler({
api,
event,
helpers,
imports
}) {
var parent = api.state.srcCase;
var selectedRec = api.state.selectedObj;
var table = api.state.table;


if (selectedRec.length > 0) {
for (var i = 0; i < selectedRec.length; i++) {
var test = api.data.apiname.execute({
"table": table,
"recordId": selectedRec[i],
"templateFields": "removed=true"
});
}
helpers.navigate.to("record", {
"table": "table_name",
"sysId": parent
});


}

}

0 REPLIES 0