@allgovmatters, have you gone through our support article Dynamic Data Attachment? It should help you solve your issue: