cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger a script from the simple workflow

simon
Champ in-the-making
Champ in-the-making
Alfresco,

I would like to join 2 nice rule features. On one side you have the simple workflow rule which adds an option to every document, on the other side one can add scripts as a rule.

I'm trying to build a backup JavaScript (as seen in the example in the WIKI) that creates a backup folder if none exists and adds a copy to this folder.

Problem is that I don't want this to happen when a document is added, removed or updated. Documents only need to be copied when the user requests this. So I would like to add the simple workflow but it should start a script instead of the copy/move it's using now. Any ideas? I can do this with the simple workflow but the backup subspace is not there when it's the first document to backup.

Some possible workaround: the user can add a new category "backup" to the document and I create a space rule that executes the backup script when a document is updated but only if it has the "backup" category applied. This strategy should work but the user needs at least 8 clicks to add this category, the "2 click simple workflow + script execution" way sounds much nicer.

I short: trigger a script with the simple workflow rule. New feature, some other ways around this? Comments are welcome.
7 REPLIES 7

simon
Champ in-the-making
Champ in-the-making
BTW: Can I remove a category once it's applied (as a web client user)?

simon
Champ in-the-making
Champ in-the-making
*bump*

gavinc
Champ in-the-making
Champ in-the-making
Yes, you can go to the view details dialog for the node and in the Category panel you can edit them and remove them all (providing the user has the permissions to do so).

Is this what you meant?

simon
Champ in-the-making
Champ in-the-making
Yes, exactly, needed some extra clicking but indeed, I can remove a category in the Change category panel. Thanks.

Any feedback on my first question?

simon
Champ in-the-making
Champ in-the-making
*bump*

Would still be nice to have an answer on the first question… anyone, no one?!

Thanks!

kevinr
Star Contributor
Star Contributor
So I would like to add the simple workflow but it should start a script instead of the copy/move it's using now. Any ideas?

As you spotted you can't do this at the moment. It's not possible at the moment with Simple Workflow. It should certainly be possible once a more fully feature JBPM style workflow is integrated (1.4 timeline).

Thanks,

Kevin

simon
Champ in-the-making
Champ in-the-making
Thanks for the reply Kevin… I'll have to wait for the 1.4 release. Maybe I could get rid of the 1.3 preview and switch to 1.3 first. Smiley Wink