Abort Attachment insertion

Prathyusha G
Tera Contributor

My requirement is to abort insertion of attachment on case table when attachment size exceeds 9MB and throw an error message.

Error message is throwing as expected but the null attachment is showing.

if (parseInt(current.size_bytes) > 9000000) {
        gs.addErrorMessage(gs.getMessage("There is a file size limit of 9MB. Please choose a smaller file"));
        current.setAbortAction(true);
    }
 
Above code is added on before insert business rule by adding table name in filter condition on attachment table.
4 REPLIES 4

Harish KM
Kilo Patron
Kilo Patron

Hi @Prathyusha G I tested your code, it works fine for me in my PDI . Can you verify is there any attachment already added to the record? or try creating a new record and test

 

HarishKM_0-1697530947748.png

 

Regards
Harish

Hi Harish,

It is working fine is Development instance but not working in Test Instance.

Hi @Prathyusha G If there is a attachment already present on the record it will display like below when you try to upload 2nd attachent.

HarishKM_0-1697532424294.png

 

Regards
Harish

no there is no attachment