Overwriting "save" action on the Properties document

cancel
Showing results for 
Search instead for 
Did you mean: 
dsalvat
Member II

Overwriting "save" action on the Properties document

Dear all, 

I am in the middle of the migration process to Alfresco, and I am stuck in a problem which I do not know exactly how to approach.

The previous system provided a generated code for each document, according to the type of document to be recorded. That means that, given a certain classification, the id number of the document would be one or another.

I've created a model, which provides a series of options to user to classify the document. (testModel.xml). Information has been modified in order to avoid any confidentiality issues.

The desired behavior would be:

  • Select a Project Code from a given List: ADD - Administration Division; DIR - Director; or END - Engineering Division. Let's select the DIR - Director option, as an example.
  • Select a System Code from a given List: GD - General Documents; or PM – Project Management. Let's select in this case the GD - General Documents, to follow the example.
  • Write a System Number, free text (E.g.: 1)
  • Select a Subsystem Code from a given List: AL Alignment; or CM Component. Let's select in this case the CM Component, to follow the example.
  • Write a Family identification, free text (E.g.: F)
  • Select a Doc Type Code from a given List: MG Management General; VI Visit Report;.... Let's select in this case MG Management General.

Once selected these options, there must be a new field on the properties, which would concatenate the codes of each category and a sequence number. In this case, the code would be: DIR-GD1CMF-MG-0001.

Is there a way to find a solution to my proposal? I know it is quite specific, but I would appreciate any clue about what would be a suitable solution (Webscripts, Java development, Javascript development). If you could also provide any reference or link I could check that would be great.

Thank you so much for your help!

Dani

1 Reply
cristinamr
Advanced

Re: Overwriting "save" action on the Properties document

Hola Daniel.

Sí que la hay, y no es muy complicada. Lo que tienes que hacer es lo siguiente:

- En tu modelo de datos debes crear una propiedad read only de tipo texto que por defecto estará sin nada.

- Al usuario seleccionar esas propiedades, puedes configurar una regla en el espacio padre para que cada vez que se actualice un documento ejecute un script.

- Ese script puedes leer estas propiedades y formar el contenido para introducirle en la "read-only":

  • lee la propiedad Project Code
  • lee la propiedad System Code
  • lee la propiedad System Number
  • lee la propiedad Family identification
  • lee la propiedad Doc Type Code
  • setear en la propiedad read only los valores concatenados (Project Code+System Code+System Number+Family identification+Doc Type Code)
  • Por supuesto: Chequea que cada propiedad contenga información y no esté vacía o nula.

Para hacer el script te dejo algunos enlaces que puedes de utilidad:

- Tutorial de Javascript en Alfresco (algo antiguo pero te servirá para aprender lo básico).

- Creating a rule | Alfresco Documentation 

- Javascript API en alfresco: JavaScript API | Alfresco Documentation 

- Javascript Console | Alfresco Add-ons - Alfresco Customizations  - Utilidad gratuita para lanzar y probar javascripts en share.

Ve comentándonos y si necesitas algo pregúntanos ;-)

Un saludo,

Cris.

--
VenziaIT: helping companies since 2005! Our ECM products: AQuA & Seidoc