The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Prevent users from updating status to resolved, closed , on hold from list view

charitha1
Kilo Contributor

By using the Client Script on need to get out put ?  and the table is incident

4 REPLIES 4

The SN Nerd
Giga Sage
Giga Sage
If you want to restrict all status changes, you need to ensure no 'list_edit' ACLs pass for the State field on the incident table.

ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

I agree with Paul here.

list_edit ACL is the best approach but remember users won't be able to edit anything in that field if ACL evaluates to false.

If you want users to change the status from list view but restrict which one to update then use before update BR

Condition: Status [IS ONE OF] Resolved OR Closed OR On Hold

Script:

gs.addErrorMessage('You are not allowed to change the status');

current.setAbortAction(true);

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Sajilal
Mega Sage

Also have a look at the OOB List Edit ACL on Incident table and replicate for your requirement accordingly.

https://YOURSERVICENOW.service-now.com/nav_to.do?uri=%2Fsys_security_acl.do%3Fsys_id%3Dfb90a1e9a6811596009e5055b5156bcd%26sysparm_record_target%3Dsys_security_acl%26sysparm_record_row%3D1%26sysparm_record_rows%3D1%26sysparm_record_list%3Doperation.nameCONTAINSlist%5EnameCONTAINSinci%5EORDERBYname

Thanks,

Saji

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

if you want client script then you need to use onCellEdit client script on incident table with that field

Note: Use proper choice values

Example:

6 - Resolved

7 - Closed

9 - On Hold

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {

  var saveAndClose = true;
  if(newValue == '6' || newValue == '7' || newValue == '9'){
  alert('Not allowed');
  saveAndClose = false;
  } else {
  saveAndClose = true;
  }
callback(saveAndClose);

}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader