Strip Email Attachments Inbound Action

wmahmud1
Kilo Explorer

Hello -

I am trying to strip all attachments that get picked up by ServiceNow under 5000 bytes so we can avoid unecessary attachments of users signatures to records.

I have looked at some examples posted already and setup something similar.   My issue is, the business rule on the sys_attachment table seems to run as I can see the script log showing the name of the file being aborted, but the email log itself, is not capturing the target (remains as empty) and not communicating back to the record.   If i turn off this busienss rule, it works fine again.

Any ideas what the issue may be?

(see attached business rule detail)

28 REPLIES 28

poyntzj
Kilo Sage

And yours has parseINT when it should be parseInt




Your routine will kill any small file, the one I have limits it to image files only.




Cheers


Thank you Julian — looks like ParseInt was the issue (in another example I saw it as ParseINT).


Dub Myers
ServiceNow Employee
ServiceNow Employee

Though this is an older post, in case anyone runs across this looking for a solution, there is a new feature in Jakarta that allows a bit more control over what happens to inline image attachments on an inbound email. This is oriented toward handling small attachments typical of logos or signature images.



See the Jakarta docs here.



This is   a basic byte-size based filter with the ability to dictate what happens to any attachment when less than the byte size



AttachTarget - does what most are used to today - associates the attachment to the target record.


AttachEmail -   associates the attachment with the sys_email record.


AttachNone - leaves the attachment orphaned and unattached to any target record.   (Allows "Preview Email' to still show the inline image.)



Why no "Delete" action?   If you don't store the attachment, then the "Preview Email" pane will show a broken link because there is no more image to reference.   Use AttachNone.


Hmm...I've tried to use this and set the minimum to 39000 bytes aka 39KB and we still have images getting through that are like 3KB.

 

Pretty frustrating.

 

If anyone has anything else that can work, please let me know!

 

Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Did you get this to work eventually? 

It sounds like you already tried this, but one interesting item is that AttachTarget is the default value of the 'glide.email.inbound.image_sys_attachment.filter.action' property.  That means if you set the 'glide.email.inbound.image_sys_attachment.filter.minimum_bytes' property only, the default action will still be to attach it to the target record.  Both need to be set to make it work.

For the attachment that made it through unexpectedly, you are saying this, correct?

You are on Jakarta or later?

'glide.email.inbound.image_sys_attachment.filter.action' is "AttachNone"?

'glide.email.inbound.image_sys_attachment.filter.minimum_bytes' is 39000?

The one that made it through unexpectedly: 

sys_attachment.size_bytes is ~3000 bytes?

sys_attachment.content_type starts with "image" (e.g. 'image/png', 'image/jpg', etc)?

Barring other business rule customizations interacting here, if those are your conditions, and it is not behaving as expected, I'd open an incident with ServiceNow support to see what is going on.