Mandatory attachment based on the condition of the catalog item variable value
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2024 06:28 AM
Hi All,
I have a requirement to make attachment mandatory based on the variable condition in the catalog item . I tried to create a UI policy but not able to fetch the "mandatory attachment" that is present on the catalog item below. I also tried to hide the "make mandatory" on the catalog item level and tried to create a variable type "Attachment" but it also isn't working. Is there any way or any catalog client script to make this happen?
Thank you.
1 REPLY 1

Community Alums
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2024 06:42 AM
Hi @phr ,
Something similar to this should work as an onSubmit Catalog Client Script.
function onSubmit() {
if((g_form.getValue('<variable name>') == 'yes') && this.document.getElementsByClassName('get-attachment').length == 0) {
g_form.addErrorMessage(getMessage('attachment_is_mandatory'));
return false;
}
}