- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2022 11:26 PM
Hi
Can anyone please help with an alternative method for document.getElementById() as DOM manipulation should be avoided in client scripts
Below is the example code
try
{
var attachments = document.getElementById('header_attachment_list_label');
if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none') {
if ((g_form.getValue('u_transition_personal_sim_card_to_corporate_mobile_plan_is_required') == 'yes')) {
alert('Document attachment is mandatory for request submission.');
return false;
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2022 03:14 AM
Hello,
Please use the solution mentioned in the below article:-
https://www.basicoservicenowlearning.in/2020/10/attachment-mandatory.html
Please mark my answer as correct based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2022 05:42 AM
Did you check the script I shared?
You need not use GlideAjax and script include.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2022 03:14 AM
Hello,
Please use the solution mentioned in the below article:-
https://www.basicoservicenowlearning.in/2020/10/attachment-mandatory.html
Please mark my answer as correct based on Impact.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2022 05:00 AM
If this is for a catalog item just make an attachment variable then make it mandatory.
See my guide on all the different ways this can be achieved below:
https://sn-nerd.com/2020/05/02/making-attachments-mandatory-in-sp-the-ultimate-guide/
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022