mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7597 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
19 lines
624 B
JavaScript
19 lines
624 B
JavaScript
// onCreateNode policy code for app:projectfolder
|
|
var project = behaviour.args[0];
|
|
var results = search.luceneSearch("+PATH:\"" + project.qnamePath + "/*\" +ASPECT:\"{http://www.alfresco.org/model/emailserver/1.0}aliasable\"");
|
|
if (results.length == 1)
|
|
{
|
|
results[0].properties["emailserver:alias"] = normalise(project.name);
|
|
results[0].save();
|
|
logger.log("Applied email alias of: " + normalise(project.name));
|
|
}
|
|
else
|
|
{
|
|
logger.log("No email folder found!");
|
|
}
|
|
|
|
function normalise(s)
|
|
{
|
|
// email alias has strict constraint
|
|
return new String(s).toLowerCase().replace(/[^a-z^0-9^.]/g, "-");
|
|
} |