- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2022 02:00 AM
Hi,
In my requirement,I have a field with type attachment, and i wanted to restrict some file type and created br,so now its restircting when i upload it, and showing error msg, but still in activity log it is getting added, but that is not required, can someone provide solution for this.
thanks & regards,
kalyani
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2022 02:59 AM
Hi,
see if you create BR on sys_attachment it will restrict but not show message
if you create BR on your table it will show error message and not restrict
In that case have both the BRs
1) it would restrict and show error message as well
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2022 02:13 AM
Hi,
is the record getting saved when you add that file?
Can you share BR script and configuration how you are restricting?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2022 02:18 AM
Hi Ankur,
this is br wch i have used,
var attach = new GlideRecord('sys_attachment');
attach.addQuery('table_name','ZZ_YYu_automation_request_task_table');
attach.addQuery('sys_id',current.u_lld_document);
attach.query();
while(attach.next()){
var strfilepdf = attach.file_name.indexOf('.pdf');
//var strfilejpeg = attach.file_name.indexOf('.jpeg');
var strfiledoc = attach.file_name.indexOf('.doc');
var strfilexlsx = attach.file_name.indexOf('.xlsx');
var strfiledocx = attach.file_name.indexOf('.docx');
var strfilezip = attach.file_name.indexOf('.zip');
var strfilezipx = attach.file_name.indexOf('.zipx');
if(attach.size_bytes > 15000000){
gs.addErrorMessage('Please upload file size within 15 mb');
current.setAbortAction(true);
blValidate_Status = false;
}
else if((strfilepdf < 0)&&(strfiledoc < 0) && (strfiledocx < 0) && (strfilezip < 0) && (strfilezipx < 0) && (strfilexlsx < 0)){
gs.addErrorMessage('Please upload file type of pdf / xlsx / doc / zip');
current.setAbortAction(true);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2022 02:22 AM
Hi,
BR is on which table?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2022 02:22 AM
table name: u_automation_request_task_table