UI Actions
Bulk Update Selected Records
Add a list button to update multiple selected records at once with custom logic.
// Client-side code
function bulkUpdateRecords() {
// Get selected records
var selected = g_list.getChecked();
if (selected.length === 0) {
alert('Please select at least one record');
return;
}
// Confirm action
var confirmed = confirm('Are you sure you want to update ' + selected.length + ' record(s)?');
if (!confirmed) {
return;
}
// Show loading message
var loadingMsg = 'Updating ' + selected.length + ' record(s)...';
g_list.addInfoMessage(loadingMsg);
// Make server call to process records
var ga = new GlideAjax('BulkUpdateProcessor');
ga.addParam('sysparm_name', 'processBulkUpdate');
ga.addParam('sysparm_record_ids', selected.join(','));
ga.addParam('sysparm_table', 'incident');
// Add update parameters (customize these)
ga.addParam('sysparm_field', 'state');
ga.addParam('sysparm_value', '2'); // In Progress
ga.getXMLAnswer(function(response) {
if (response) {
var result = JSON.parse(response);
if (result.success) {
g_list.addInfoMessage('Successfully updated ' + result.updated + ' record(s)');
g_list.refresh();
} else {
alert('Error: ' + result.message);
}
}
});
}How to use it
1. Create a new UI Action on your table 2. Set Name to "Bulk Update" 3. Set Table to "incident" (or your table) 4. Check "List button" checkbox 5. Check "Client" checkbox 6. Set Order: 100 7. Paste the code above in the Script field 8. Create the BulkUpdateProcessor Script Include (server-side handler) 9. Test by selecting multiple records in a list
Adapt the table names, fields, and conditions to your instance. Test the behavior in a development environment before using it in production.