Home > Forum > General > Deleting attachments

Deleting attachments
0

Hello,

I would like to create a process that deletes all attachments from my current app.
I selected option: Remove attachment and all binary data

But when i look into DB: [WFDataAttachmets] i see the records for my given instance
Also when i look into [BPS_Content_Att].[dbo].[WFAttachmentFiles] also i see records for my given instance

Is there a possibility to delete, to free up space or something? Which is the best option to delete everything regarding attachments?

Thank you!

In reply to: Jacek Wojnar

hi,
yes, metadata remains but what takes up the most space, the column [WFAttachmentFiles].[ATF_Value] is empty after that operation.

Thanks, but for example if
1. I remove attachment using option Remove attachment and leave attachment’s history, in [BPS_Content_Att].[dbo].[WFAttachmentFiles] ATF_Value is not 0x.
And then 2. If i create my process using option Remove attachment and all binary data, the BPS_Content_Att].[dbo].[WFAttachmentFiles] ATF_Value is still not deleted.

How can i delete BPS_Content_Att].[dbo].[WFAttachmentFiles] ATF_Value, if previously on same instance i have removed attachments BUT using option 1 Remove attachment and leave attachment’s history ?

It says No attachments found.

MVP

Hi Maria,
I can see only one option, as deleting attachments is not possible directly in workflow global scope action.

1. Create a technical path on each step, which should be taken into consideration for deleting attachments.
2. To that path add an action (from template) - you could delete attachment and historical binary data or only historical binary data (this would leave latest version in the system).
3. Create a global action, which would use 'Move workflow (SQL)' action. Within select specify instances which should have attachments deleted. I'd recommend preparing it in a way, that it will run on X instances only, but few times, as processing more than 50 documents in one batch might end up with timeouts.

Instead of global action, you could also write some script which would get data from SQL, and move instances using webcon REST API - this way you can avoid timeouts, but it requires more work.


In case of already deleted attachments I'm not sure, but sounds like it could require direct update on database, and before doing it globally, i'd try to check how it works on one element on dev env if possible. Manual updates are against best practices, but sometimes it's the only solution and even webcon does it if necessary.

You could also think about using archive option, which would delete document from WEBCON, but it's more than just removing attachments.
A workaround could be an action that will clone existing document as new one, and delete the old one, but it's not the best solution.

MVP
In reply to: MariaM

Have you tried this? Did you encounter any issues?

What option are you using?

Hi,
Yes - I did a test of your case on my DEV (sandbox) environment

1. I added the attachment
2. I removed the attachment via the action "Remove attachment and leave attachment's history" (the value in the ATF_Value column remained)
3. I tried to remove the attachment and all binary data (nothing happens - no attachment found)
4. * I marked the attachment as not removed (UPDATE [WFDataAttachmets] SET ATT_IsDeleted = 0 WHERE ATT_ID = xxxx)
5. I removed the attachment via the action "Remove attachment and all binary data" and ATF_Value is empty

I don't know if there is another way (in your case), but this one unfortunately requires a manual change in the database, which is NOT RECOMMENDED/SUPPORTED by WEBCON