03-19-2007 08:01 AM
A
B
Year
Month
Day
<content import in B>
Actually I have a rule which create sub spaces and move imported content in. So, when I import a content in the space A, the rule moved the content in sub space defined by the date.A
Year
Month
Day
<content import in A>
The Javascript is following :// Move document to YYYY/MM/DD structure
// First, find or create target folder
var current = document.properties["cm:created"];
var year = current.getFullYear();
var month = current.getMonth() + 1;
var day = current.getDate();
var yearSpace = space.childByNamePath(year);
if (yearSpace == null) {
yearSpace = space.createFolder(year);
}
var monthSpace = yearSpace.childByNamePath(month);
if (monthSpace == null) {
monthSpace = yearSpace.createFolder(month);
}
var daySpace = monthSpace.childByNamePath(day);
if (daySpace == null) {
daySpace = monthSpace.createFolder(day);
}
// Then move document
document.move(daySpace);
The problem is how can I modify this code to create the sub spaces (Year, Month and Day) into the space of the import (B. It may have more than one space at this level) ?03-20-2007 05:02 AM
// Move document to YYYY/MM/DD structure
// First, find or create target folder
var current = document.properties["cm:created"];
var year = current.getFullYear();
var month = current.getMonth() + 1;
var day = current.getDate();
var yearSpace = document.parent.childByNamePath(year);
if (yearSpace == null) {
yearSpace = document.parent.createFolder(year);
}
var monthSpace = yearSpace.childByNamePath(month);
if (monthSpace == null) {
monthSpace = yearSpace.createFolder(month);
}
var daySpace = monthSpace.childByNamePath(day);
if (daySpace == null) {
daySpace = monthSpace.createFolder(day);
}
// Then move document
document.move(daySpace);
03-20-2007 08:30 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.