Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2025 05:51 AM
HI Team,
I am working on a requirement where I need to create a new field type(file attachment) and which need to accept only pdf format.
Can someone please help?
eew-ijgp-qke
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2025 05:53 AM
Hello,
You can create onBefore insert/update Business Rule to accept PDF File format.
Try below script:
Table: Your_Table_Name
Condition: File Attachment changes
var attachRef = new GlideRecord('sys_attachment');
if (attachRef.get(current.u_pdf_attachment)) {
var fileType = attachRef.getValue("content_type");
if (fileType.toString() != "application/pdf") {
gs.addErrorMessage("Please attach PDF File Format.");
current.setAbortAction(true);
}
}
Please mark my response as Accepted and Helpful for future references.
Thanks
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2025 05:53 AM
Hello,
You can create onBefore insert/update Business Rule to accept PDF File format.
Try below script:
Table: Your_Table_Name
Condition: File Attachment changes
var attachRef = new GlideRecord('sys_attachment');
if (attachRef.get(current.u_pdf_attachment)) {
var fileType = attachRef.getValue("content_type");
if (fileType.toString() != "application/pdf") {
gs.addErrorMessage("Please attach PDF File Format.");
current.setAbortAction(true);
}
}
Please mark my response as Accepted and Helpful for future references.
Thanks