Skip to content

Is there an existing API function to count how many attachments of a specific Document Class exist for a given record (e.g. attachments on a Customer Invoice), rather than writing custom counting logic from scratch?

Answer

Yes — DOC_REFERENCE_OBJECT_API.GET_OBJ_CONN_CLIENT_HIT_COUNT() can do this: call it with the logical unit name, a key reference string built from the record's own key fields (e.g. 'COMPANY=' || company || '^INVOICE_ID=' || invoice_id || '^' for a Customer Invoice), and optionally a specific Document Class filter as the fourth parameter — it returns the matching attachment count directly, avoiding the need to write your own attachment-counting query against the Document Management tables.

← Browse Document management questions