cancel
Showing results for 
Search instead for 
Did you mean: 

Archiving documents in the workflow

bedo115
Champ in-the-making
Champ in-the-making
Hi,

For my master thesis, I have to make a workflow with activiti and integrate it in alfresco.

I need to archive the attachement document in the workflow and it doesn't work.

I'm trying to create a script task with the script of the back-up (script in alfresco) :

// find the backup folder - create if not already exists
var backupFolder = space.childByNamePath("Backup");
if (backupFolder == null && space.hasPermission("CreateChildren"))
{
   // create the folder for the first time
   backupFolder = space.createFolder("Backup");
}
if (backupFolder != null && backupFolder.hasPermission("CreateChildren"))
{
   // copy the doc into the backup folder
   var copy = document.copy(backupFolder);
   if (copy != null)
   {
      // change the name so we know it's a backup
      copy.name = "Backup of " + copy.name;
      copy.save();
   }
}

When I deploy the workflow, I have no error.

When I execute the workflow, the variable "space" is unkown by alfresco or activiti (I don't know which one).

Have you a idea to resolve this error ?
Have you a idea to back-up a document with activiti ?


Thank you for your help


My configuration :

Ubuntu 11.04
Activiti 5.9
Alfresco Community 4.0
7 REPLIES 7

nitroin
Champ in-the-making
Champ in-the-making
I'm also interested in this topic, please give some up if you find something usefull, thanks.

yz250
Champ in-the-making
Champ in-the-making
I am looking for that too, I' ve done many searchs on the web but nothing.
Please sort it out.

Ivan

trademak
Star Contributor
Star Contributor
Hi,

Where does this space variable come from then?
In my Activiti in Action book I show how to retrieve and store documents in Alfresco with a Java service task.
The example code is available for your usage.

Best regards,

bedo115
Champ in-the-making
Champ in-the-making
Hi,

The variable space is a define variable in alfresco ( like variable action, compagnyHome, …) but it can not be used outside.

Thank you for the reference book, but I have not yet buy. I found the source code comes with the book.

In which chapter is the service task which you speak?

Thank you for your help

Greg

trademak
Star Contributor
Star Contributor
Hi,

It's part of chapter 13.

Best regards,

houstoniasian
Champ in-the-making
Champ in-the-making
Is it possible to store document in local database but not in Alfresco?

frederikherema1
Star Contributor
Star Contributor
You can store byte-arrays as a variable in activiti, this will be stored in the Activiti-databas and can be retrieved through the API on a later point in time. Also, take a look at "Attachment" entity we have (see taskService) for adding documents to tasks, independent of alfresco.