01-29-2021 04:49 AM
I'm trying to establish some import/conversion automation for newly added documents, but struggle with document duplication.
Users place documents into a site directory via WEBDAV or FTP, where they shall be transformed to PDF automatically. With a folder rule using "transform and copy content" action, this was quite straight forward.
However, documents are duplicated now, because the transformation creates a new (PDF) document, but does not remove the uploaded original. This somehow sounds like a no-brainer, but so far, I was not able to find a solution - neither here nor in Alfresco itself.
Any hints how to achieve this? Ideally without programming completely new actions...
(Platform: ACS 6.2 GA)
01-29-2021 08:01 AM
Instead of using the default (dummy) "transform and copy content" action rule, you could create a script which simply does "transform and udpate content" on the file that was uploaded to avoid the duplication. Such a script can be created in the "Data Dictionary/Scripts" folder within Alfresco, and used via the "Execute Script" folder rule action. But it requires some basic programming ability.
01-29-2021 08:01 AM
Instead of using the default (dummy) "transform and copy content" action rule, you could create a script which simply does "transform and udpate content" on the file that was uploaded to avoid the duplication. Such a script can be created in the "Data Dictionary/Scripts" folder within Alfresco, and used via the "Execute Script" folder rule action. But it requires some basic programming ability.
01-29-2021 12:09 PM
Thanks for that helpful reply and pointing me in the right direction.
Regarding the "required programming abilities", I would consider myself quite experienced within general Java development. However, Alfresco is completely new to me, and I've trouble identifying the right spots to achieve the wanted solution.
Is there any place you could point me, where I would find "similar" scripts, that I could use as a starter?
01-31-2021 07:25 AM
Ok, figured it out. A simple script like this, already does the job:
var transformedNode = document.transformDocument("application/pdf"); if (transformedNode.exists()) { document.remove(); }
Quite simple, but if you're new to Alfresco, this puts you for a challenge.
02-01-2021 06:05 AM
Hi @joergd & welcome to Alfresco,
Great news you've found a solution & thanks for updating us with the code example - really helpful to other users.
Cheers,
Explore our Alfresco products with the links below. Use labels to filter content by product module.