
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2014 03:17 AM
Hi All,
I have to validate whether user has added an attachment or not before allowing him to submit a request.Please help me if any of you have done a similar kind of implementation.
Regards,
Kirti
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2014 04:59 AM
Write the below on submit script
function onSubmit() {
var attachmentList = gel("header_attachment_list_label");
if (attachmentList)
{
if (attachmentList.style.visibility == "hidden" || attachmentList.style.display == "none")
{
alert("Please attach the required file.");
return false;
}
}
}
Regards,
Harish.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2014 03:51 AM
Try a client script that will look at the sys_attachment table and see there is a record in that table for your current record
var gr = new GlideRecord('sys_attachment');
gr.addQuery('table_sys_id',g_form.getUniqueValue());
gr.query();
if (gr.next())
// we have record
else
// No record - alert user
// do something else

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2014 05:12 AM
Using Gliderecord is not preferable clientside So i avoided this approach

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2014 04:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2014 04:48 AM
You want this on a catalog item or RITM Form.
If its on the FORM then its better to have a business rule on attachment table
When - After
Condition - (with conditions so that it only runs for you and not other tables)
Insert
Script
- var gr = new GlideRecord('sc_req_item');
- gr.addQuery('sys_id',current.table_sys_id);
- gr.query();
- if (gr.next())
- {
- gr.work_notes="/* whatever you want to print, attachment name may be*/"
- gr.update();
- }