How can I programmatically copy an attachment from a parent record and link individual copies to multiple child records in Creatio Freedom UI?
I need to implement a solution where a parent record has an attachment uploaded. When I click a button, I want to automatically create a copy of this attachment for each related child record, so that every child record will have its own attachment (not just a shared reference). For example, if there are 4 child records, there should be 4 distinct copies of the original attachment, each linked to a different child.
Like
This sounds like something server code could perform - the File API documentation here has an example that could be adapted to meet that requirement under the collapsed example titled "Copy a file from the original file storage, paste the file to a new file storage, and delete the file from the original file storage".
Also, as a no-code approach, you do this with a Process File element in a process.
Example to copy opportunity files to account
Ryan
Ryan Farley,
Thank you. I have two section both freedom UI, so I have tried two approaches but nothing worked.
Approach 1. Selecting case(attachment and notes object)
Approach 2 - Using uploaded File and passing Case record Id
Bulk Update is a freedom UI section so there is no separate attachment object for it.
Thanks,
Akshit
Akshit Saxena,
I think the "What object to save file to?" field should be the object you want the file to be associated to, e.g. in your first example it would simply be "Case". Then the Case's Id would go in the subsequent field. That's how we have Process File elements set up and it works, although that's for a Custom Object, so the file ends up in the "Uploaded file" Object rather than one of the bespoke OOTB XFile Objects that exist for Account and Case.
Harvey Adcock,
Thank you. I have to save file in the case attachment object from Custom Bulk Update attachment object. I tried to select case only in "What object to save file to?" but it does not show option to select only case in the dropdown.
Hi Akshit Saxena,
The section that you are looking for is Case (Attachments and notes detail object in Cases section).