How to make attachment mandatory on 'File Attachment' type field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2018 11:59 PM
Hello experts,
I have a requirement where we need attachment to be mandatory for the creation/submission of a record- but on a 'File Attachment' type field. I could achieve this using a before insert business rule for the Attachment icon on the banner. But I am unable to do the same for this kind of field. Our instance is on London release. Please provide your input on this.
PFA ss for reference.
BR,
Shilpa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2018 12:18 AM
Hi Shilpa,
Make use of hasAttachements() method on GlideRecord for this.
if (current.hasAttachments() == true) {
gs.addInfoMessage('There is an attachment');
} else {
gs.addErrorMessage('There is no attachment');
current.setAbortAction(true);
}
Cheers,
Sunil B N
P.S: Please mark this as an answer/helpful if it was useful to you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2018 12:08 AM
Hi Sunil,
Thanks for the reply.
I have the same BR- before insert on my table. But when I try to attach something using 'Attach Resume' field - which is a 'File Attachment' type field it gives me the following error and does not allow attaching using this field. Please assist how can I make attachment mandatory in this case.
BR,
Shilpa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2018 01:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2018 12:08 AM
Hi Priyanka,
Thanks for the reply.
I have the same BR- before insert on my table. But when I try to attach something using 'Attach Resume' field - which is a 'File Attachment' type field it gives me the following error and does not allow attaching using this field. Please assist how can I make attachment mandatory in this case.
BR,
Shilpa
Hi Shilpa,
You can make attachment mandatory on the form.
So you have to write Business Rule (Before - insert) , Suppose table is Incident (You can apply to any table according to your requirement)
This is working fine for me
Try this below script :-
Before Attached documents in Attachment icon.
After Attached documents in Attachment icon.
After Attachment
Let me know if you have any questions.
Please mark it Correct or Helpful, if it works based on impact....!!!!
Warm Regards,
Priyanka
www.dxsherpa.com