how to check if attachments are added before submitting the RITM?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
How to check if attachments are added to the catalog item before submitting the Request?
Regards,
Saranya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi @saranyavs ,
You can write an onSubmit Client script for it .
code:
function onSubmit() {
// Check attachment count using GlideRecord
var attachment = new GlideRecord('sys_attachment');
attachment.addQuery('table_sys_id', g_form.getUniqueValue()); // RITM sys_id
attachment.query();
if (!attachment.next()) {
alert('Please attach a file before submitting.');
return false;
}
return true;
}
If this answers your question, please mark it as helpful and accept the solution for better community visibility.
Thanks,
Vishnu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
I tried this method, but 'g_form.getUniqueValue()' is the sys id of item, not the RITM. so code is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @saranyavs ,
Just make attachment mandtaory by configuring the catalog item.
If you're taking about making attachment type of variable mandatory then use UI policy to make attachment variable mandtaory.
If my answer helps then please mark it helpful & accept this solution.
Thanks,
Utpal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hello @saranyavs ,
For checking the attachments are added/mandatory just check the checkbox in catalog item form section :
If my response helped mark as helpful and accept the solution.
