AnsweredAssumed Answered

Change version manually?

Question asked by patrik on Sep 24, 2007
Latest reply on Sep 25, 2007 by patrik
Hi! It seems to be hard to change the version number by executing a script. Is there things i need to do before? My code is the following:

var refName = document.properties["cm:name"];
var refFile = companyhome.childByNamePath(refName);
document.properties.autoVersion=false;
document.properties.versionLabel=refFile.properties.versionLabel;
document.save;

var logFile = space.childByNamePath("log.txt");
if (logFile==null)
{
   var logFile = space.createFile("log.txt");
}
if (logFile!=null)
{
   logFile.content+= "\n\r" + " Version refFile" + refFile.properties.versionLabel + " Version document " + document.properties.versionLabel;
}

What the script is supposed to do is to take the version from a file under Company Home which has the same filename as the file that is referred to as "document". The logfile gives this output:

              Version refFile1.1 ref Version document 1.1

Which indicates that the version is updated to 1.1 but in the browser it's still 1.0. I have tried to make to following change in contentModel.xml:
      <aspect name="cm:versionable">
         <title>Versionable</title>
         <properties>
            <property name="cm:versionLabel">
               <title>Version Label</title>
               <type>d:text</type>
               <protected>false</protected>
            </property>

But without any success.

Hints?

Outcomes