how to hide impact values based on the incident category in the list view

mumashankar
Kilo Contributor

how to hide impact values based on the incident category in the list view

 

So as per the Requirement I need to show the different impact values when i selected two different categories in category drop down list i can achieve in form level but i am not able to achieve in list level i tried with client script on cell edit 

mumashankar_0-1780314648119.png

 

3 REPLIES 3

Venky Kshatriy2
Mega Sage

Hi @mumashankar 

In ServiceNow dependent choice filtering works on forms but not in list views or report filter dropdowns so you can't hide impact choices by category in the list editor out of the box.
To enforce the dependency use a Before Business Rule or Data Policy to block invalid combinations on save or disable list edit for the impact field and require editing on the form.

If this response addressed your question, please mark it as Helpful and accept it as the solution.

Ankur Bawiskar
Tera Patron

@mumashankar 

not possible to show/hide options in list view

Better approach

1) restrict list edit using list_edit ACL for that field and ensure users update only via form

OR

2) use before update BR to validate if user selected correct impact value based on category, if not then abort the update

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Tanushree Maiti
Tera Patron

Hi @mumashankar 

 

Since list views are optimized for rapid data access, they do not support dynamic client-side choice filtering (for example, via UI Policies).

To prevent field updates or conditionally restrict available choices in a list, implement the logic using server-side controls and cell-editing scripts.

 

Either you can

1)Hide Choices in the Form View 

OR 

2)Prevent List View Updates  by onCellEdit Script

Sample script:

function onCellEdit(sysIDs, table, olds, news, callback) {
var newValue = news;
var impactVal = parseInt(newValue, 10);

if (g_form.getValue('category') == 'software' && impactVal == 1) {
alert("You cannot set this Impact value for the Software category from the list view.");
callback(false);
} else {
callback(true);
}
}

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti