We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Need to accept only PDF format.

pawank2
Tera Expert

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
1 ACCEPTED SOLUTION

Not applicable

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

 

View solution in original post

1 REPLY 1

Not applicable

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