1

i am trying to extend alfresco's document management by running a script. So far, i have managed to create a Custom Model with a Custom Type and Property as seen below:

enter image description here

the said Custom Type is under this Custom Model (never mind the Custom Aspect for now)

enter image description here

the custom type is working so far, i managed to apply it to a certain document as you can see below (Notice the Control Code Field)

enter image description here

now what i want to do is to add an auto incrementing function that will be set as the value of the Control Code Property (ie: [FILE0012])

i tried utilizing the scripts rule from alfresco but it seems like the commands are limited to that of alfresco's functionalities. not even alert() or console.log functions work. i thought that if i can make a script that could call an ajax to my php server, i can extract the document's property, and insert it to my database and get the rowid then attach it to a word "FILE" so it becomes the Control Code Property (ie: a document was inserted to my database at row 1996, then the Control code is [FILE1996], this is because i joined '[FILE' and 1996 and ']'

but like i said, what happened was, the javascript commands are limited to that of alfresco's needs.

i tried to make my research but i've only bumped on 2 outdated (and i mean outdated) threads dating back to 2006-2010. which does not help me quite well with Alfresco's current build structure.

i hope someone can help me with here. connecting to the database is not mandatory, but if i can make it do as such then it'll give me quite a rather amazing results.

TheQuestioner
  • 702
  • 10
  • 28
  • I hope I've well understood but it seems that you need to link an action to a rule (when the document is created, you need to generate a control code). In an action you can do what you want (generating the code in the action, or call a webservice) => http://ecmarchitect.com/alfresco-developer-series-tutorials/actions/tutorial/tutorial.html – Akah Aug 09 '16 at 06:43

1 Answers1

1

Take a look at the "cm:countable" aspect. You do not have uniqueness guaranteed OOTB, so take that into account.

Example: http://www.avantec.se/howto-create-an-auto-increment-field-on-an-object-in-alfresco/

Lista
  • 2,186
  • 1
  • 15
  • 18