How can I make attachment mandatory in condition.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2021 05:01 AM
suppose We have 4 checkbox variable in catalog form.
name of checkbox variable is A,B,C & D. AND checkbox A will always ticked.
Make attachment mandatory only in another check box next to "A" is ticked(B or C or D anyone or ALL)
Thank you!
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2021 05:27 AM
Hi,
To make attachment mandatory in all conditions, you can use OOB 'Mandatory Attachment' field on catalog item. To make attachment mandatory based on other catalog variable, please go through below link
SERVICE PORTAL: REQUIRE ATTACHMENTS
Add extra condition in client script to check the variable values, see the first if condition and update the variable names
function onSubmit() {
if(g_form.getValue('b')=='true' ||g_form.getValue('c')=='true'){ //update field values
//Works in non-portal ui
try {
var attachments = document.getElementById('header_attachment_list_label');
if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none' ) {
alert('You must attach a document before submitting this request.');
return false;
}
}
//For Service Portal
catch(e) {
var count = getSCAttachmentCount();
if(count <= 0) {
alert('You must attach a document before submitting this request.');
return false;
}
}
}
}
If I have answered your question, please mark my response as correct and/or helpful.
Thanks,
Suseela P.