How to prevent users from setting State to On Hold in list views only?

aaronanders
Giga Contributor

Use case: Incidents moving to an on hold status in our instance has many mandatory fields to be filled out.

We don't want to prevent agents from updating the state for Incident in list view altogether but we want to prevent them from doing this in list/portal list views.

Data policies and business rules don't have access to your current view.  Without removing the ability to edit the State altogether in list view, how can this be managed?

1 REPLY 1

Vishal Jaswal
Giga Sage

Hello @aaronanders 

Here is onCellEdit Client script:

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
    var saveAndClose = true;
    //Type appropriate comment here, and begin script below
	var viewName = g_list.getView();
    if (viewName == 'portal') { //System UI > Views
        alert('You are not authorized to update State Value "On Hold" in the Portal view.');
        saveAndClose = false;
    }
    callback(saveAndClose); // Returning false prevents the update
}

VishalJaswal_2-1777478051391.png

 




Validation:

VishalJaswal_1-1777478023893.png

 

 


Hope that helps!