Count amount of attachments

I need save digit of amount of attachments for record of device and probsummary.

After i made trigger for sysattachments (after add) - script calculate all new records for sysattachments but i need only with unique UID.

Tags: