Automatic category registration

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

Automatic category registration

Newbie question:

 

I'm using version of Aflresco Community - 5.2.0 (r135134-b14) I'm custmizing page of the document-details.

 I could implement adding the category at the time of registration by adding the aspect.
However, I want to automatically add it to the category based on the information of document property when registering or updating a document.

 

As far as I know ,can do with Alfresco Share Javascript API.

How do I use ?

 

Please how should I solve this problem?

Thanks in advanced.

2018.3.22 Add

 Originally, an operation to add a category from the category manager

   I want to do it together with the automatic registration of categories by the content of document property information.

Example)

1. Introduction There are the following categories.

Category root

  + "Manufacturing date"

  + "Manufacturing location"

2. Register the following documents.

   Document name: strawberry cake

    Property (manufacturing date) March 2013

    Property (manufacturing place) kitchen

 <When you register>

Category root

  + "Manufacturing date"

        + "March 2018"     <= Newly created

  + "Manufacturing location"

2. Register the following

        + "Kitchen"            <= Newly created

3. We will add category "Strawberry Cake" category automatically

5 Replies
Senior Member II

Re: Automatic category registration

You can use behaviour/policies. Behavior or policies are basically kind of action events of document.So if you would like to do something whenever the document is updated/created/delete , you can use this policies.There are lot many other behavior also available for example event of uploading the new version etc..

There is nice blog written by Jeff Potts‌.Please take a look on that for more details.

Implementing Custom Behaviors in Alfresco | ECMArchitect | Alfresco Developer Tutorials 

Customer

Re: Automatic category registration

Hi:

A very very basic example via content rule, based on filenames with existing tags or categories:

- Name-based autocategorization or tagging in Alfresco via content rule - zylk 

Regards.

--C.

Senior Member II

Re: Automatic category registration

The simplest way: you could add rules to folders that get triggered if you create, change,... documents in these folders or their subfolders.

Your are able to use Aspect-Properties and their values to link categories to your document:

Rule actions | Alfresco Documentation 

Harder, but more flexible:

Also you are able to execute a java-script (placed in data dictionary/scripts) that get's the triggering document injected. You can access the properties with the document.properties[...] object/array

https://docs.alfresco.com/community/references/rule-actions.htmlScriptNode API | Alfresco Documentation 

 finding your category is a bit complicated:

Classification API | Alfresco Documentation 

once found you can add it via document.properties["cm:categories"]

if you need real complex actions and have to get control over the values before and after the update, you need to implement a behaviour using java, like ‌ described

Senior Member II

Re: Automatic category registration

Hi Cesar, you were faster - again :-)

Active Member

Re: Automatic category registration

Thanks Krutik Behaviour
policies is likely to be useful.
Is it better to implement new categories here?
Thanks Cesar
  Automatic registration to the created category worked fine.
Thanks Martin
  A link to the API is also helpful. Thank you.