Attachment Catalog Variable Type - Mandate file type.

Jon Collins2
Kilo Sage

Hi Folks,

 

When using the "Attachment" catalog variable type, is there a way I can mandate file attachments be a specific type? Say PDF? We have a requirement to mandate files be PDF on a specific catalog item. Is this possible in ServiceNow?

 

Thanks in advance. 

1 ACCEPTED SOLUTION

Prince Arora
Tera Sage
Tera Sage

@Jon Collins2 

 

In Variable attributes you can restrict the attachment type by extensions.

For example:

You can use allowed_extensions=pdf;txt    etc

 

Please find the link here , solved in community,

 

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

View solution in original post

2 REPLIES 2

Prince Arora
Tera Sage
Tera Sage

@Jon Collins2 

 

In Variable attributes you can restrict the attachment type by extensions.

For example:

You can use allowed_extensions=pdf;txt    etc

 

Please find the link here , solved in community,

 

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

Kamil Smusz
Kilo Sage

Hi Jon,

 

I have OnSubmit Client Script to check if there is attached attachment with correct extension.

function onSubmit() {

    var CSR_required = g_form.getValue('would_you_like_it_to_create_the_private_key_and_csr');
    var att = this.document.getElementsByClassName('get-attachment').length; //[0].innerHTML;

    if (CSR_required == "No") {

        if (att == 0) {
            alert("Please attach the Required CSR file to proceed with submitting.");
            return false;
        } else {

            for (var i = 0; i < att; i++) {

                var file_name = this.document.getElementsByClassName('get-attachment')[i].innerHTML;

                if (file_name.indexOf('.csr') != -1) {

                    return true;

                } else {

                    alert("Please attach the file with .csr extension to proceed with submitting.");
                    return false;
                }
            }


        }
    }
}