Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Alternative method for document.getElementById()

Anusha Dande
Tera Expert

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;
}
}

1 ACCEPTED SOLUTION

Saurav11
Kilo Patron

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.

View solution in original post

7 REPLIES 7

@Anusha Dande 

Did you check the script I shared?

You need not use GlideAjax and script include.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Saurav11
Kilo Patron

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.

paulmorris
Giga Sage

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