cancel
Showing results for 
Search instead for 
Did you mean: 

How to create Node tree automatically

sanatmastan
Champ in-the-making
Champ in-the-making
Hi,

I have defined following model, when ever i create a node of type ppb3cg3:CG_ContentInstance it should create entire node tree i,e it should automatically create ppb3cg3:heading and make it referred by ppb3cg3:CG_ContentInstance, how can i achieve this?

      <type name="ppb3cg3:heading">
         <title>Heading Content Unit</title>
         <parent>ppb3cg3:CE_HtmlElement</parent>
         <overrides>
            <property name="ppb3:id">
               <default>heading</default>
            </property>
         </overrides>
      </type>


      <type name="ppb3cg3:CG_ContentInstance">
         <title>Content Instance</title>
         <parent>ppb3:ContentInstance</parent>
         <associations>
            <child-association  name="ppb3cg3:CU_heading">
               <title>heading</title>
               <source>
                  <mandatory>true</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>ppb3cg3:heading</class>
                  <mandatory>true</mandatory>
                  <many>false</many>
               </target>
            </child-association>
         </associations>
      </type>

1 REPLY 1

invictus9
Champ in-the-making
Champ in-the-making
Well, "automatically" is relative.

You can set up a trigger on a space to run a script to check if the required heading is created when the content is created, and establish the link.

Search the Alfresco wiki for Javascript API, and look at node services.