Attachments in ServiceCatalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello All
I have been working on restricting the number of attachments to be added on a catalog form. You may ask to use three variables with type 'Attachment', but it does not look good or give a good interface.
So, I developed a catalog script of 'onSubmit', attaching below.
But the issue is this shows a infoMessage: This catalog client script is not VA supported due to the presence of the following variables in the script: this.document.getElementsByClassName.length.
Even tried with g_form.getAttachments(), same.
function onSubmit() {
//Type appropriate comment here, and begin script below
var attacha = this.document.getElementsByClassName('get-attachment').length;
//var attacha = g_form.getAttachments();
if(attacha>3)
{
g_form.addErrorMessage('Maximum number of attachments is 3');
return false;
}
return true;
}
Would appreciate if we have any workaround which can solve this by Catalog client script itself.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Your script is correct
kindly check if the Isolate Script field is set to False for this Catalog Client Script to ensure DOM manipulation works