cancel
Showing results for 
Search instead for 
Did you mean: 

How to embed document version in document name.

sprudhom
Champ in-the-making
Champ in-the-making
I have a traceability requirement to be able to go back to the right version in Alfresco from the document itself.
For example a customer recieves version 1.3 of document X.doc . How does he know it's version 1.3?

Can I force the document name to be changed from X.doc to X-1.3.doc when it's downloaded?
Also is there a way to embed the version number automatically in Word documents?

Many thanks.

   Serge
5 REPLIES 5

niketapatel
Star Contributor
Star Contributor
Hi sprudhom, To answer your question - How user can know version of document.

If you are using alfreso share then when you hower your mouse on document it shows current document version.
In explorer, User can check from document detail page. From property view - "Version Label"

And to append current version of document in name, You can have custom behavior or rule when content gets updated get version of content and append with name.But this would require customization.

Hope it helps!

sprudhom
Champ in-the-making
Champ in-the-making
"And to append current version of document in name, You can have custom behavior or rule when content gets updated get version of content and append with name.But this would require customization."

This is exactly what I am looking for. Could expand on this?

Many thanks.

  Serge

edwardb
Champ in-the-making
Champ in-the-making
How did you get on?

We also would like to have the Alfresco document version appear in a Word doc for traceability.  Appended to a file name is no good once the document is printed.

scouil
Star Contributor
Star Contributor
Hello,

Here is a really good tutorial by Jeff Potts on the creation of behaviours in Alfresco.
http://ecmarchitect.com/archives/2007/09/26/770
You'll find a great range of actions that you can intercept.

If you still don't know where to start after reading this, come back and we'll help you further.

niketapatel
Star Contributor
Star Contributor
Hi

1)For rule - You can create rule which executes your custom javascript on content update
You can check js API detail here - http://wiki.alfresco.com/wiki/4.0_JavaScript_API#Versions_API

On a quick note, you can have below js example. You need to manage same named node doesnt exist,etc..


var versionHistory = document.versionHistory;

if (versionHistory != null)
{

  var version = versionHistory[0];
  var label = version.label;
  document.name = document.name + label;
  document.save();
}



2)For custom behaviour, You can have your custom policy which implements - AfterCreateVersionPolicy or OnCreateVersionPolicy as per your requirement.
Please check this artlicle for detail example - http://ecmarchitect.com/images/articles/alfresco-behavior/behavior-article.pdf