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.

How to hide an incident state (canceled) from the list view?

Jesus Nava
Tera Guru

Hello experts, please I need your help, how can I hide the choice canceled from the "state" dropdown from the list view?

find_real_file.png

Thank you

1 ACCEPTED SOLUTION

Community Alums
Not applicable

@Jesus Nava same script i have used & tested , able to edit on list view and change any state except cancel, working code on my PDI

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
    var saveAndClose = true;
    if (newValue == 😎 {
        alert("You cannot change the state to Closed from the list view.");
        saveAndClose = false;
    }
    callback(saveAndClose);
}

View solution in original post

11 REPLIES 11

Community Alums
Not applicable

@Jesus Nava same script i have used & tested , able to edit on list view and change any state except cancel, working code on my PDI

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
    var saveAndClose = true;
    if (newValue == 😎 {
        alert("You cannot change the state to Closed from the list view.");
        saveAndClose = false;
    }
    callback(saveAndClose);
}

I had an error in the script, fixed it and worked, thank you!!