2

I am interested in triggering code to run when any changes are made to any documents or folders under a specific folder in alfresco. I am sure alfresco has to support this some how but I am not entirely sure what the feature/api/service is called or what to google for. What has this ability in alfresco and what is it called?

I am aware that its possible to create custom content rules in javascript and then add them to a folder to be triggered by some action. I did that a couple years back for auto filing documents that were dropped into a specific folder. Problem is that requires adding that action to each folder you want to monitor. I want to monitory an entire directory tree basically.

EDIT: Correct me if I am wrong, but it appears that Events API may do what I need to do. I found this right after posting my question.

startoftext
  • 3,846
  • 7
  • 40
  • 49

2 Answers2

3

You probably just want to create a Rule on the top folder, and set it to apply to subfolders. If you're interested in changes, then set a When of "Items are updated". Depending on your needs, you could also restrict it to only items of a given type or aspect (eg to pick up document changes, but not folder changes)

Finally, you can either have your Rule run a JavaScript file (Execute script) to perform the business logic, or you can register a Java Custom Action and have that triggered

Gagravarr
  • 47,320
  • 10
  • 111
  • 156
3

@Gragravarr answer is the best for handling events over a subtree of the repository.

In case what you need to monitor is only a subset of all the content of the subree (e.g. watch all the incoming documents, but only if they are PDF) and possibly scattered across the whole repository, then creating a specific content type and handle events using Policies is probably a better option.

Community
  • 1
  • 1
skuro
  • 13,414
  • 1
  • 48
  • 67