On change client script error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2024 11:15 PM
Hi All,
We are getting an error on state field 'onChange script error: TypeError: Cannot read properties of null (reading 'up') function onChange_change_request_state_14(control, oldValue, newValue, isLoading, isTemplate) { if (isLoading || newValue === '') { return; } if (newValue != "-5" || newValue != "-4") { $("impact_annotation").up().hide(); } else { $("impact_annotation").up().show(); } }'.
Below is the on change client script
Can anyone please help me on how to get rid of that error. Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2024 02:44 AM
Hi @Community Alums ,
First you have to make your client script isolated "true".
change the code like below
var element = document.getElementById('impact_annotation');
if (!(newValue == "-5" || newValue == "-4")) {
if (element) {
element.parentElement.style.display = 'none';
}
}else{
if (element) {
element.parentElement.style.display = '';
}
}
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
LinkedIn: https://www.linkedin.com/in/runjay
YouTube: https://www.youtube.com/@RunjayP
-------------------------------------------------------------------------