Can I preview an attachment for ServiceNow?

Allen17
Tera Contributor

I need to preview attachment in the record, what should i do?

1 ACCEPTED SOLUTION

Raf1
Tera Guru

You should be able to use document viewer:

more info on this link

View solution in original post

3 REPLIES 3

Raf1
Tera Guru

You should be able to use document viewer:

more info on this link

Allen17
Tera Contributor

it is very helpful to me,thanks

Kunal Varkhede
Tera Guru

Hi Allen,

If you are looking for mandatory attachments on any catalog item. uou need to create catalog client script.

Using below script, you can achieve this.

 

function onSubmit() {

var cat_id = gel('sysparm_item_guid').value;

var gr = new GlideRecord("sys_attachment");

gr.addQuery("table_name", "sc_cart_item");

gr.addQuery("table_sys_id", cat_id);

gr.query();

if (!gr.next()) {

alert("You must attach a file to submit.");

return false;

}

}

Please mark helpful/correct answer if it is applicable.

Thanks,

Kunal Varkhede.