blob: 321855a43b5300daf5a529509cb43ae3c5b8760a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
<?xml version="1.0" encoding="UTF-8"?>
<cristalscript>
<output name="errors" type="com.c2kernel.scripting.ErrorInfo"/>
<script language="javascript" name="CreateNewNumberedVersionFromLast"><![CDATA[
var viewName = job.getActPropString("ViewName");
if (viewName.equals(""))
throw "ViewName not specified. Cannot create new version.";
var lastView = -1;
var existingViews = item.getContents("/ViewPoint/"+viewName);
for (i=0; i<existingViews.length; i++) {
var thisView = parseInt(existingViews[i]);
if (thisView!=NaN && lastView < thisView) lastView = thisView;
}
lastView++;
try {
var existingLast = agent.unmarshall(item.queryData("/ViewPoint/"+viewName+"/last"));
} catch (e) {
throw "No data found. You must submit at least one version before executing this activity.";
}
existingLast.setName(lastView);
agent.execute(item, "AddC2KObject", existingLast);
]]></script>
</cristalscript>
|