Attachment mandatory for a Catalog Item

sam352120
Kilo Guru

Hi All,

I want to make attachment mandatory based on a specific field values selected for a catalog item when the user will submit the form.

find_real_file.png

When the User will select the check box above and try to submit the form then attachment made will be mandatory.

if not checked there will be no message appear and the form will be submitted without any issue.

Thanks,

Sambit

 

1 ACCEPTED SOLUTION

Bhagyashri Sort
Kilo Guru

Hi,

 Please refer below links, it might help you.

OnChange variable to make Attachment Mandatory Client Script

Mandatory Attachment on Submit based on Catalog Item Variable

 

Mark it correct and helpful.

Thanks

Bhagyashri Sorte.

View solution in original post

11 REPLIES 11

Bhagyashri Sort
Kilo Guru

Hi,

 Please refer below links, it might help you.

OnChange variable to make Attachment Mandatory Client Script

Mandatory Attachment on Submit based on Catalog Item Variable

 

Mark it correct and helpful.

Thanks

Bhagyashri Sorte.

sriram35
Kilo Guru

Hi Sam,

 

you have to write onSubmit client script for this

Please use below script it will work

if (g_form.getValue('service_requests') == 'reconnet') {  // service_request = your variable name and reconnet = choice name
var cat_id = g_form.getValue('sysparm_item_guid');
var att = new GlideRecord("sys_attachment");
att.addQuery('table_name', 'sc_cart_item');
att.addQuery('table_sys_id', cat_id);
att.query();
if (!att.hasNext()) {
g_form.addErrorMessage('You must attach a document to submit');
return false;

}

}

 

Hope this helps!

If you have any more questions, please let me know.

If I have answered your question, please mark my response as correct and helpful.

Thanks,

Sriram