Skip to content

Instantly share code, notes, and snippets.

@jgoldhammer
Last active December 19, 2016 12:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgoldhammer/e6a91672da18ba90fd3a978b8737fb8e to your computer and use it in GitHub Desktop.
Save jgoldhammer/e6a91672da18ba90fd3a978b8737fb8e to your computer and use it in GitHub Desktop.
Create a temporary (not persisted) job in alfresco to run javascript code in the backend
jobs.scheduleTemporaryJob({
jobName: 'SimpleAuthorModificationJob',
runAs: 'system',
cronExpression: '0 0/1 * 1/1 * ? *',
script: function(){
batchExecuter.processFolderRecursively({
'root': repository.getCompanyHome(),
onNode: function(node) {
if (node.isDocument) {
node.properties['cm:author'] = 'Alfresco';
node.save();
}
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment