Getting "cannot read properties of null (reading parentNode)" error

Ap_1
Tera Contributor

I have written a onLoad client script to hide an annotation along with the fields inside it.

 

if (cmdbtableservice == 'cmdb_ci_computer')
      {
        document.getElementById("functionalresponsible").parentNode.style.display = "none";
        document.getElementById("operationalresponsible").parentNode.style.display = "none";
        g_form.setMandatory('u_administrated_by', false);
        g_form.setDisplay('u_administrated_by', false);
}
 
Now I tried to debug the script via developer tool and there I put breakpoint on line no 3 and get the below message.
 
Ap_1_0-1709740858288.png

Though this same script is working on another instance.

 

Can anyone please help me on this.

2 REPLIES 2

Sandeep Rajput
Tera Patron
Tera Patron

@Ap_1 If this script is working on the other instance and not in your instance then need to check following things.

 

1. Script should be in the Global scope

2. Isolate script checkbox on the script form should be unchecked.

 

Screenshot 2024-03-06 at 9.34.41 PM.png

Script is in global scope an isolate script is unchecked only.

Ap_1_0-1709742535852.png