How to make an Attachment mandatory in a record producer?

Community Alums
Not applicable

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?

2 REPLIES 2

johnfeist
Mega Sage
Mega Sage

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.

 

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

Sumanth16
Kilo Patron

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.