How to make an Attachment mandatory in a record producer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2023 01:39 PM - edited 05-10-2023 01:45 PM
Hello! I need to know how to make an Attachment mandatory in a record producer. I have to make it mandatory when one of the fields of the form has a certain value, that is, it has conditions. I know that in a catalog item it is easy because there is a checkbox to select, but the record producer does not have it. Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2023 02:43 PM
Hi Rocio,
You can add a variable of type Attachment. From there, you can have Catalog UI Policies or Catalog Client Scripts control visibility and mandatory.
:{)
Helpful and Correct tags are appreciated and help others to find information faster
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2023 02:47 PM
Hi Rocio,
function onSubmit() {
//Type appropriate comment here, and begin script below
if (g_form.getValue('attachment') == 'yy') {
if (window != null) {
var attachments = document.getElementById('header_attachment_list_label');
if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none') {
alert('You must attach the screenshot');
return false;
}
} else {
if (this.document.getElementsByClassName('get-attachment').length == 0) {
alert('You must attach the screenshot');
return false;
}
}
}
Please mark it as helpful (or) correct if it fixes your issue.
(or)
Hi,
I would suggest to use the attachment type variable for attaching the attachment and us UI policy to make it mandatory based on your required conditions.
You can achieve it with out scripting and It is recomanded as a best practices.
Thanks & Regards,
Sumanth Meda.