Dom manupaulation
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2024 10:20 PM
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 .
:

It is not working as excepted. We identified that Dom manipulation is not working on current ServiceNow version .
:
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2024 11:03 PM
Hi @SravyaA ,
try this out with isolate script =false
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 ((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;
}
}
}
Regards,
Chaitanya
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 12:03 AM
We tried but no use
same error
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 12:07 AM
Try check "Isolate script"
From Docs;
Isolate script | New client scripts are run in strict mode, with direct DOM access disabled. Access to jQuery, prototype, and the window object are also disabled. To disable this on a per-script basis, configure this form and select the Isolate script check box. To disable this feature for all new globally-scoped client-side scripts set the system property glide.script.block.client.globals to false. |
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 12:13 AM
We tried to check the isolate script check box .it shows the same error as above mentioned.