Hi everyone, im new to aem and using aem 6.5 now, and i want to ask a question, is it possible to set node type when creating new node at the same time, ive followed several tutorial, most of the are using java, but usually it also work when i convert it to js, heres the example:
this code below work on java :
fileNode = root.addNode("image-1", "nt:file");
but thats not work in JS, it work in js if im only creating node without set the node type, like this code below :
var fileNode = root.addNode("image-1");
ive also try to set the node type using node.setPrimaryType but it still didnt work. any suggestion to make it work in JS ? or any article that ican read. thank you.
var session = request.resourceResolver.adaptTo(javax.jcr.Session); var node = request.resourceResolver.getResource("/content/dam/demo").adaptTo(javax.jcr.Node); var node1 = node.addNode("debal-aem-resource" ,"nt:file"); var node2 = node1.addNode("jcr:content","dam:AssetContent");