How to set 1Mb for picture attachment in a form level
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2024 10:01 PM
How to set 1Mb for picture attachment in a form level
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2024 12:57 AM - edited ‎04-27-2024 12:58 AM
Hi @krishna svg ,
If you want to do it globally use this KB article and modify the system property and set the size you want:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0718101
If you want to do it to only on a particular table/form and particular type of attachment format write a before insert BR on sys_attachment table:
var grInc = new GlideRecord('sys_attachment');
grInc.addQuery('table_name',"incident");//change table name according to your requirement
grInc.addQuery('table_sys_id',current.sys_id);
grInc.Query();
var totalSize=0;
while(grInc.next()) {
totalSize+= parseInt(grInc.size_bytes);
}
if(totalSize > 1) {
gs.addInfoMessage("Attachment size exceeded");
current.setAbortAction(true);
}
This code is not tested.Please use log messages to and correct your code accordingly.
Please mark my answer helpful/correct if it resolved your query