- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2019 06:42 AM
Hi Folks,
I have one client script in on submit this will check the attachments are added or not, but if attachments are added also this is not working any help this is the script:
function onSubmit() {
if(g_form.getValue(field) == 'true' ) {
var MSG_NO_ATTACHMENT = "Please add aattachemnts";
try {
var attachmentsNon = document.getElementById('header_attachment_list_label');
alert(attachmentsNon);
if (attachmentsNon.style.visibility == 'hidden' || attachmentsNon.style.display == 'none' ) {
alert(MSG_NO_ATTACHMENT);
return false;
}
} catch(e) {
alert(e);
var count_att = getSCAttachmentCount();
alert(count_att);
if(count_att <= 0) {
alert(MSG_NO_ATTACHMENT);
return false;
}
}
}
}
I am getting error : TypeError: Cannot read property 'getElementById' of null and it is not allowing submitting the request in portal I added attachments
Any help?
Regards,
Chaitanya Kumar.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2019 07:32 AM
Hi Chaitanya,
set isolate = false for that onSubmit client script and try once
https://community.servicenow.com/community?id=community_blog&sys_id=c5c46364dbba6b007d3e02d5ca9619cb
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2019 06:49 AM
Do you have Isolate script set to false? This is a field on the client script form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2019 07:40 AM
YES BUT STILL NOT WORKING
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2019 07:32 AM
Hi Chaitanya,
set isolate = false for that onSubmit client script and try once
https://community.servicenow.com/community?id=community_blog&sys_id=c5c46364dbba6b007d3e02d5ca9619cb
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2019 07:41 AM
YES BUT STILL NOT WORKING
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2020 11:11 PM
Hi! Have you added the properties to enable the DOM manipulation?
glide.script.block.client.globals