As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Consult the Javascript API on the Alfresco wiki. It has a list of functions that can be called from Javascript to affect the node repository.You can specialize a content type (change to a subtype) by using node.specializeType("my:newsubtype"). You can also use node.addAspect("my:newAspect").
<type name="ct:customFolder"> <title>Custom</title> <parent>cm:folder</parent> <properties> <property name="ct:code"> <type>d:text</type> <mandatory>true</mandatory> </property> <property name="ct:year"> <type>d:int</type> <mandatory>true</mandatory> <constraints> <constraint ref="ct:yearValidate"/> </constraints> </property> </properties> <mandatory-aspects> <aspect>ct:customAspect</aspect> </mandatory-aspects> </type>
<type name="ct:customFolder"> <title>Custom</title> <parent>cm:folder</parent> <properties> <property name="ct:code"> <type>d:text</type> <mandatory>true</mandatory> </property> <property name="ct:year"> <type>d:int</type> <mandatory>true</mandatory> <constraints> <constraint ref="ct:yearValidate"/> </constraints> </property> </properties> <mandatory-aspects> <aspect>ct:customAspect</aspect> <aspect>ct:newAspect</aspect> </mandatory-aspects> </type>
var addAspect = actions.create("add-features"); addAspect.parameters["aspect-name"] = "ct:newAspect"; nodes = search.luceneSearch("TYPE:\"ct:customFolder\""); for each (var node in nodes) { addAspect.execute(node); }