AnsweredAssumed Answered

JS script

Question asked by .jan on Jul 14, 2014
Latest reply on Jul 14, 2014 by kaynezhang
Hi
I am trying to add JS script which will auto fill atribute of document after I create it. Is there way to write this script into alfresco before I create .amp file for deployment ?
It is primitive script like:

<javascript>
var settings = companyhome.childByNamePath("Data Dictionary").childByNamePath("Settings").childByNamePath("idGen1");

var docId = parseInt( settings.properties["sc:idGenerator"] );
settings.properties["sc:idGenerator"] = docId + 1;
settings.save();

document.properties.name = document.name + "-" + docId;
document.save();
</javascript>

Outcomes