Change version manually?
![patrik patrik](https://connect.hyland.com/legacyfs/online/avatars/Blue-user-logo.png)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2007 12:28 PM
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?
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?
Labels:
- Labels:
-
Archive
2 REPLIES 2
![slothrop slothrop](https://connect.hyland.com/legacyfs/online/avatars/Blue-user-logo.png)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2007 04:36 PM
You could try to remove the aspect, change it and readd it. This has worked for me with custom aspects when just reassigning a value didn't work:
No guarantees, though.
var oldVersion = document.properties[cm:versionLabel];/*increment however you see fit*/document.removeAspect("cm:versionable");var props = new Array(1);props["cm:versionLable"] = newVersion;document.addAspect("cm:versionable", props);
No guarantees, though.
![patrik patrik](https://connect.hyland.com/legacyfs/online/avatars/Blue-user-logo.png)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2007 06:29 PM
Thanks for you reply! But it didn't work even though i tried your suggestion. Fortunately, however, i managed to find out what i needed to do. After i set
document.properties.initialVersion=false;
it worked. It looks like the version property becomes static and not automatically set. It even seems impossible to check out the document afterwards but luckily i don't need that in this case.
document.properties.initialVersion=false;
it worked. It looks like the version property becomes static and not automatically set. It even seems impossible to check out the document afterwards but luckily i don't need that in this case.
![](/skins/images/3EA4296CAFBBFFCF1FE252BDE05FE3BC/responsive_peak/images/icon_anonymous_message.png)