how to change "attachments" dynamically