Make "On Hold Reason" Mandatory for Multiple Incident State Selection in List View

LokeshwarRV
Tera Contributor

Hi Community,

I'm working on a requirement where we need to enforce the "On Hold Reason" field as mandatory when multiple incidents are updated to the "On Hold" state from the list view. and also for single selection

Here’s the specific scenario:

  • When users select multiple incidents in the list view and change the Incident State to "On Hold", the "On Hold Reason" field should become a mandatory field before the update is allowed.
  • This should apply consistently across all incidents being updated in bulk.

Has anyone implemented a similar validation or can suggest the best approach to achieve this? Would a UI Policy or a Client Script work in list view bulk updates, or is a different method required?

Any guidance or examples would be greatly appreciated!

Thanks in advance,

LokeshwarRV_0-1754425346264.png

 





5 REPLIES 5

raviteja1600
Tera Guru

Hi @LokeshwarRV ,

 

You can use the Before Business Rule (which is a ServiceNow recommendation)

Create a new Business rule on Incident wth below information

 

Table: Incident

When to run: Before - Update

Advanced: checked

 

Script:

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
if (current.state == '3' && previous.state != '3') {
    if (!current.hold_reason) {
        gs.addErrorMessage("On Hold Reason is required when setting the state to 'On Hold'.");
        current.setAbortAction(true); // Prevents the update
    }
}

})(current, previous);

If the provided solution is helpful to you, please mark it as "helpful" and accept the solution.

Regards,

Raviteja