Attachment ilmit for Incident table

Joshuu
Kilo Sage

Hi All,

 

We are limiting the attachment size with the below script in ServiceNow incident table.

(function executeRule(current, previous /*null when async*/) {
var grInc = new GlideRecord('sys_attachment');
grInc.addQuery('table_name',"incident");
grInc.addQuery('table_sys_id',current.table_sys_id);
grInc.query();

var totalSize=0;

while(grInc.next()) {
totalSize+= parseInt(grInc.getValue('size_bytes'));
}

if(totalSize+parseInt(current.getValue('size_bytes')) > 25000000) {
gs.addErrorMessage("Size of attachment(s) should be less than 25MB.");
current.setAbortAction(true);
}
})(current, previous);

 

But with this, unable to download the incident records from reports if the mentioned limit exceeds. Can we exclude this script for reports?

 

Please assist.

 

Thanks & Regards.

3 REPLIES 3

Natan F Rosa
Kilo Guru

Hi @Joshuu 

I'm not understand very well this part

"But with this, unable to download the incident records from reports if the mentioned limit exceeds. Can we exclude this script for reports?"

Do you can expland me more?

Hi @Natan F Rosa ,

 

Due to this script, unable to download reports on the incident table.

Hi @Joshuu 

Would you have any more evidence?
This scenario is still a bit strange and doesn't make much sense. Why do you think it's because of this script that you can't download the reports?