ServicePortal": TypeError: Cannot read property 'element' of null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2020 01:35 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2020 03:47 PM
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
Kindly mark my answer as Correct and Helpful based on the Impact.
Regards,
Alok

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2020 04:15 PM
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