Not able to hide the Short description field while loading the incident form?

RajeshEdaguttu
Giga Contributor

Hello Everyone,

I have written a client script which is onLoad type and I set short description filed to be hidden and description field to mandatory for incident table but when I load or refresh the Incident form changes are not reflected. Could you please help me how to fix this issue and what could be the reason?

3 REPLIES 3

Dr Atul G- LNG
Tera Patron

Please check whether this is mandatory at the dictionary level, as that might be the reason. Also, verify which table you are trying to use—you might need to override the dictionary as well.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Tanushree Maiti
Tera Patron

Hi @RajeshEdaguttu 

 

This issue occurs because ServiceNow does not allow mandatory fields to be hidden. If a field is marked as required, any attempt to hide it will be ignored.

To resolve this, remove or disable the mandatory setting for the field before applying the visibility change in your Client script /ui policy.

 

1. If you are using Client SCript -> Update OnLoad client script :

 

function onLoad() {
g_form.setMandatory('short_description', false);
g_form.setDisplay('short_description', false);
g_form.setMandatory('description', true);
}

 

Else update existing UI policy.

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

Ankur Bawiskar
Tera Patron

@RajeshEdaguttu 

share script here and client script config screenshots and the outcome screenshots

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