Home > Forum > Actions > Add Attachment - Copy existing category

Add Attachment - Copy existing category
0

MVP

Hello,
I'm configuring a clone feature for nested workflows, and i need to copy attachments from parent workflow to new parent, and from child elements to new children.
Something like this:

-Parent
--Child
--Child

-NewParent
--NewChild1
--NewChild2

It's easy to copy Parent attachments - I'm starting parent with `Start a subworkflow` action, which has `Copy attachments to subworkflow` option - this works great.
This is the first step I have in my automation.

Unfortunately Category of the attachment is missing.

I've been thinking about creating another automation, which will use `Modify attachment` action, and another `For Each` operator to make it happen.
However it is possible to have few attachments with same name, and there is no way to get correct category for them - at least I couldn't think of one.

Even without the nesting of the workflows I can't find any way to get the Categories - any ideas? :)

MVP

Okay I've been trying out some things, and finally came up with solution.
I'm not checking `Copy attachments to subworkflow`, instead on the Path used to Start element I've placed an Automation.

It's easier to just copy the documents more manually with automation, than correcting categories.

On new document I'm keeping ID of original one, which is used to select attachments from old document.
This is used as input for `For Each` operator, inside which I'm doing two steps:
* Change local parameter value - `SQL Command` select returning Category, based on current ID in the loop.
* Add attachment, based on current ID in the loop, and there - set the Category to dynamic and use local parameter.

Seems like it works, but I'm still open for any other solutions, maybe there will be something cleaner :)