- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2016 09:23 AM
Hi guys, i was wondering if someone can gave me some advice of how to make mandatory the attachments before the submit in the change request form. Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2016 09:34 AM
Try an onSubmit client script. Something like this:
function onSubmit(){
var attachment = new GlideRecord('sys_attachment');
attachment.addQuery('table_name','change_request');
attachment.addQuery('table_sys_id',current.sys_id);
attachment.query();
if(!attachment.next()){
alert ("Please include attachment");
return false;
}
}
Cheers,
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2016 10:20 AM
You can do it in server sided without using GlideRecord query.
Please go through below thread.
Making attachment mandatory in change request ?
Thanks,
Mihir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2016 10:23 AM
- Create a business rule ...before one
- if (current.hasAttachments() == true)
- {
- // do something
- }
- else
- {
- current.setAbortAction(true);
- //do something
- }
PS: Hit like, Helpful or Correct depending on the impact of the response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2019 11:41 PM
Hi svizcaino
First of all current object is not used in client script so please first at least try all those client script on your instance then mark it correct.
so the correct c;ient script is
function onSubmit()
{
var gr = new GlideRecord('sys_attachment');
gr.addQuery('table_name','change_request');
// gr.addQuery('table_sys_id',5e43d262e1f1330078502406b63333d0);
gr.query();
if(!gr.next())
{
alert ("Please include attachment");
return false;
}
}
I am also attaching Screenshot for your reference.
If your work is completing by using my client script please MARK CORRECT/HELPFul to my answer.
Regards
Yash.K.Agrawal