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)
Solved! Go to Solution.
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.
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.
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?
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.
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,
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.