Catalog script validate attachment Error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 04:19 AM
Hi community,
Could you please help me to fix the Solution for the below script (Catalog script validate attachment)
Error MessageonSubmit script error: TypeError: gel is not a function:
function () { [native code] }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 04:58 AM
Hi @Khaled RAJHI ,
You can replace the gel
function with document.getElementById
. Here's the modified version of your script:
function onSubmit() {
// Get the catalog sys_id value using document.getElementById
var catalogsysid = document.getElementById('sysparam_item_guid').value;
// Create a new GlideAjax object
var ga = new GlideAjax('CheckAttachment');
ga.addParam('sysparm_name', 'attachmentCount');
ga.addParam('sysparm_catalogsysid', catalogsysid);
// Call the server-side script synchronously
ga.getXMLWait();
// Get the response from the server
var attCount = ga.getAnswer();
// Check if attachment count is less than 1
if (attCount < 1) {
alert('Please Attach your Passed Certification');
return false;
} else {
return true;
}
}
Also, refer below similar thread:
Thanks,
Ratnakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 05:11 AM
I tried the new script and a new error returned
onSubmit script error: TypeError: Cannot read properties of null (reading 'getElementById'):
function () { [native code] }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 06:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 06:36 AM
@Jagadish Sanadi Same Errors !