The Zurich release has arrived! Interested in new features and functionalities? Click here for more

ServicePortal": TypeError: Cannot read property 'element' of null

ah16
Mega Expert

Since, I cannot use g_form.getElement in Service Portal. What is the alternative to read and set values? I used the following syntax but still getting TypeError: Cannot read property 'element' of null

var x=angular.element(document.getElementById("dur-hours-u_start_date_of_activity"));
console.log("test value"+x.val());

 

Thanks,

Ashraf

 

2 REPLIES 2

Alok Das
Tera Guru

Hi Ashraf,

Not sure what is your actual requirement and what your complete code looks like. However, please find the below links which could be helpful for you in writing the client scripts.

https://hi.service-now.com/kb_view.do?sysparm_article=KB0719250

https://docs.servicenow.com/bundle/istanbul-servicenow-platform/page/build/service-portal/concept/un...

https://docs.servicenow.com/bundle/orlando-servicenow-platform/page/build/service-portal/concept/uns...

Kindly mark my answer as Correct and Helpful based on the Impact.

Regards,

Alok

Hitoshi Ozawa
Giga Sage
Giga Sage

 

Have you checked the following thread? Move to the bottom first to get the updated information.

https://snprotips.com/blog/2017/7/21/how-to-enable-dom-manipulation-in-the-servicenow-service-portal