Posted: 26 Mar 2021 1:48 EDT Last activity: 7 Apr 2021 13:44 EDT
how to remove a particular attachment from a Case or work object
i have a requirement like i am attaching a PDF to a case using attach smart shape and its working fine also,but there is a scenario like i have to rerun the flow again and attach the same pdf again but i am getting an error like same repository and folder already exists which is breaking the flow and logic i tried to delete the attachment also and that also not working.
kindly help me with a solution to attach the same pdf or any other way to attach it to work object by deleting the previous attached one.
Generally, I'm not sure if it's a bug or expected behavior by default it restricts uploading the file with the same name in the repository. ( you could tweak this functionality to append a timestamp to make the filename unique, but this doesn't make sense in your use case as these might take the space unnecessarily)
If you have written any custom logic for deleting the attachment then make sure you handle the link-attachment, Data-WorkAttach-file instances gracefully and for deleting the file in the repository you can make use of the below API.
Thanks for the reply. its the default behavior of Pega that it wont allow to attach same file twice.in my use case first time attachment is working fine and its attached properly but there is a specific scenario like for an update i have to run the flow again and attach the same pdf file again but that is not happening because of duplicate issue and as a result flow is moving to problem flow which is not ideal.
i need a solution to some how attach the same file again and again even by deleting the first one or by keeping both.