How to append the creator and create-time to a file name automatically.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2014 09:22 PM
I hope to append the creator and "create time" to a file name while I create a document from a template.
For example:
template name: reimbursement-record.xls
After the file created, file name changed to: reimbursement-record-Smith-20140214.xls
Wonder if there is an easy way?
Thanks in advance!
For example:
template name: reimbursement-record.xls
After the file created, file name changed to: reimbursement-record-Smith-20140214.xls
Wonder if there is an easy way?
Thanks in advance!
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2014 11:45 PM
Hi Andy, you can do it by either custom behaviour or by executing custom js as a rule on folder when particular type of content gets added.
Please check below forum, in which document version is being appended in document name, same way you can get document creator and created date.
http://forums.alfresco.com/comment/141879#comment-141879
Hope it helps!
Please check below forum, in which document version is being appended in document name, same way you can get document creator and created date.
http://forums.alfresco.com/comment/141879#comment-141879
Hope it helps!
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2014 02:27 AM
Hi
For rule,At first,I have writen a XXX.js,Second executes the custom javascript on content update,but it doesn't work,could you tell me why? is there something wrong in the XXX.js?
Thanks in advances!
the XXX.js code as following:
var versionHistory = document.versionHistory;
if (versionHistory != null)
{
var version = versionHistory[0];
var creator = version.creator;
var createdDate = version.createdDate;
document.name = document.name +"-"+ creator +"-"+ createdDate;
document.save();
}
For rule,At first,I have writen a XXX.js,Second executes the custom javascript on content update,but it doesn't work,could you tell me why? is there something wrong in the XXX.js?
Thanks in advances!
the XXX.js code as following:
var versionHistory = document.versionHistory;
if (versionHistory != null)
{
var version = versionHistory[0];
var creator = version.creator;
var createdDate = version.createdDate;
document.name = document.name +"-"+ creator +"-"+ createdDate;
document.save();
}
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2014 03:08 AM
The version history probably does not exist. Why aren't you using the auditable aspect of the document itself?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2014 05:55 AM
Hi
At first,thanks for your solution and I have writen code like this,but is still doesn't work,could you tell me where is error?
Thank you very mush!
this code as following like this
var aspects = document.aspects;
for(s in aspects){
if(s!=null && s=="auditable"){
document.name += s.properties.creator;
document.name += s.properties.created;
break;
}
}
document.save();
At first,thanks for your solution and I have writen code like this,but is still doesn't work,could you tell me where is error?
Thank you very mush!
this code as following like this
var aspects = document.aspects;
for(s in aspects){
if(s!=null && s=="auditable"){
document.name += s.properties.creator;
document.name += s.properties.created;
break;
}
}
document.save();