Group Mail Merge

Hi

We have created a group from a custom entity.  We then use this to run a mail merge.  The documents are not saved under the custom entity and are not linked in anyway to that entity.  Is there any way of amending this?

The documents are visible on the company entity but we would like to use advanced SQL about the custom entity to do a filter of records that have had certain documents.

If we use the mail merge button on the custom entity it does relate it back to the custom entity.

Thanks in advance.
Sarah