Need to show alert when attachment is not added while submitting the request in the portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 12:23 AM
Hi,
I need to show an alert when attachment is not added while submitting the request.
I am using On Submit client script.
var cat_id = g_form.getValue('sysparm_item_guid');
alert(cat_id);
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;
}
It is showing alert when attachment is added also.
Thanks in Advance...
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 12:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 12:41 AM
Hi,
you can check my blog and get the count of attachments; enhance it as per your requirement
Verify Mandatory Attachments Count on Catalog Item
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2022 07:00 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2022 04:18 AM
Hello,
If you are fine with my response, Please hit like and mark my response as correct if that helps.
Regards
Regards,
Musab