- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2020 09:05 AM
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.
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
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2020 06:53 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2020 06:53 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2020 07:16 AM
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