Home > Forum > Actions > Copy Attachments of an item list into another item list

Copy Attachments of an item list into another item list
0

Hello.

I have a subworkflow here I copy the content of an item list of the parent WF (change item list values). That works fine, but the attachment I have in parent item list I don't get copied/moved/linked.

Has anybody an idea?

Kind regards
Klaus

MVP

Hi Klaus,

as Karol pointed out, you need to update the value of the "related attachment" field after the attachments have been copied to the new workflow.
If you take a look at the field in the database you will see, that it contains the attachment ids in a comma separated list. At least if you allow multiple attachments.

Since the attachments would have all a unique name for a workflow instance, you could use this to map the attachments of both workflow instances to get the 'old' and 'new' attachment id and update the values later.
It will get a little tricky but I did something similar in the past.

If you wouldn't need the attachments in the parent workflow any longer, and there references in the item list, you could test to "move" the attachments to the sub workflow and even back at some point in time. I would guess, that the attachment id won't change in this case. But the help says something different:
https://docs.webcon.com/docs/2023R2/Studio/Action/Attachments/Action_AddAttachment#6-source-files-settings
Move attachments to the current instance – attachments will be added to the current workflow instance. After being added, they are removed from the source instance.

Best regards,
Daniel