Dom manupaulation

SravyaA
Tera Contributor

Hello All,

 

We have one catalog client script which uses dom manipulation.

 

function onSubmit() {

    //var checkValueOfField = g_form.getValue('u_select_user_profile');

    // check CT or ITP access is contained within the variable
    //if (checkValueOfField.indexOf('d03dd507db1d3f40034de0a1ca96196c')>=0 || checkValueOfField.indexOf('1a3dd507db1d3f40034de0a1ca96199e')>=0){


    //run attachment check
    if (g_form.getValue('type_request') == "inquiry") {

        if ((this.document.getElementsByClassName('get-attachment').length == 0)) {

            // no attachment uploaded, we alert user and dont submit request

            alert('Attachment (screenshot of error) is mandatory for incident submission.');

            return false;


        }
    }
}

It is not working as excepted. We  identified that Dom manipulation is not working on current ServiceNow version .
:
SravyaA_0-1733379618701.png

 

Based on the below link:
We made isolated script to false and created the property which mentioned in the article but the issue remains same. 
 
Please do need full help.
 
Regards,
sravya.A
10 REPLIES 10

Hi @SravyaA ,

have you removed "this." that was present before document object?

if not please remove it and test it

 

Regards,

Chaitanya

Hello ,

It is working once we attached the attachment it still asking to attach  twice. 

Community Alums
Not applicable

Hi @SravyaA , 

 

Please check the below link , it will help you to resolve your issue.

 

Alternative of DOM manipulation  

 

Thanks,

Vikas 

Chaitanya ILCR
Kilo Patron

Hi @SravyaA ,

remove  "this." that was present before document object.

with isolate script as false.

 

 

Regards,

Chaitanya

Not working it is asking twice to attach the attachment already I attached the attachment.