Instead of:



attachment.addQuery('table_sys_id','sys_id');



could you please try with:



attachment.addQuery('table_sys_id',sys_id);



Also, please check this thread: Catalog service making Mandatory Attachment both application and SP