Leftover documents after conversion

cancel
Showing results for 
Search instead for 
Did you mean: 
joergd
Active Member

Leftover documents after conversion

Jump to solution

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)

1 Solution

Accepted Solutions
afaust
Master

Re: Leftover documents after conversion

Jump 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.

View solution in original post

4 Replies
afaust
Master

Re: Leftover documents after conversion

Jump 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.

joergd
Active Member

Re: Leftover documents after conversion

Jump to solution

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?

joergd
Active Member

Re: Leftover documents after conversion

Jump to solution

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.

EddieMay
Alfresco Employee

Re: Leftover documents after conversion

Jump to solution

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,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!