<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic JavaScript to create a child node in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/javascript-to-create-a-child-node/m-p/245636#M198766</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have a quick question please. I need to create a JS script for Alfresco that would look for a space and if found, will create in it a child space with a given name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know to look for the parent Space I can use this code&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;var ParentSpace = space.childByNamePath("parentSpaceName");&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;So then to create the child node I have created this&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;if (ParentSpace != null &amp;amp;&amp;amp; space.hasPermission("CreateChildren"))&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ChildSpace = space.createFolder("ChildName");&lt;BR /&gt;}&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;but with this what I get is the "child space" to be created at the same level than the Parent Space, not inside the Parent Space&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any Suggestions on how I can "tell" the code to create the child space inside the Parent Space?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot guys &lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://connect.hyland.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Jun 2009 17:25:42 GMT</pubDate>
    <dc:creator>mrey</dc:creator>
    <dc:date>2009-06-29T17:25:42Z</dc:date>
    <item>
      <title>JavaScript to create a child node</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/javascript-to-create-a-child-node/m-p/245636#M198766</link>
      <description>Hi allHave a quick question please. I need to create a JS script for Alfresco that would look for a space and if found, will create in it a child space with a given name.I know to look for the parent Space I can use this codevar ParentSpace = space.childByNamePath("parentSpaceName");‍So then to crea</description>
      <pubDate>Mon, 29 Jun 2009 17:25:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/javascript-to-create-a-child-node/m-p/245636#M198766</guid>
      <dc:creator>mrey</dc:creator>
      <dc:date>2009-06-29T17:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript to create a child node</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/javascript-to-create-a-child-node/m-p/245637#M198767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The "space" variable will always be populated with the space the script is currently running against. Similar with "document" although you aren't using that in this example.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So instead of space.createFolder() you need to do ParentSpace.createFolder(). Also, in your hasPermission() check, you want to run that on the ParentFolder, not the current space.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2009 20:03:49 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/javascript-to-create-a-child-node/m-p/245637#M198767</guid>
      <dc:creator>jpotts</dc:creator>
      <dc:date>2009-07-10T20:03:49Z</dc:date>
    </item>
  </channel>
</rss>

