How to restrict the attachment file size from 1024MB to 25MB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2024 06:00 AM
Hi Community,
I have written record producer for case form on CSM Portal
As of now OOB file size attachment is allowed up to 1024MB, but the requirement is to restrict to 25MB
Could you please provide the steps to restrict file size from 1024MB to 25MB
Thanks,
Srinivasu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2024 06:24 AM
Hi @Srinivasu2 ,
You can call the script include & in script include you can query attachment table. In attachment table you will have size field. Based on that you can abort action.
If my answer helped you in any way, please mark it as helpful or correct.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2024 06:47 AM
Please follow the below steps:
1) Go to "System Properties > Security"
2) Update "Maximum file attachment size in megabytes" to 25
3) Click Save button
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2024 07:03 AM - edited 05-28-2024 07:06 AM
Hi @Srinivasu2
In case you want to have a specific limit for any you can write a business rule on sys_attachment table (Before Insert).
(function executeRule(current, previous /*null when async*/) {
if(parseInt(current.size_bytes) > 1000000 && current.table_name == 'incident')
{
//Abort the insert if size is greater than 1MB --> 1000000bytes
gs.log('Size has been exceeded');
current.setAbortAction(true);
}
})(current, previous);
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0718101
Regards,
Sid