cancel
Showing results for 
Search instead for 
Did you mean: 

Search for content type

alarocca
Champ in-the-making
Champ in-the-making
Hello,

into my custom model I defined a base content type, for instance my:doc (parent is cm:content), and some properties. Then I created few other content types having my:doc as parent (for instance, my:subdoc1, my:subdoc2, my:subdoc3, ..).

Within share-config-custom.xml I created the following configuration for search on my:doc:

   <config evaluator="model-type" condition="my:doc">
      <forms>
            <form id="search">
               <field-visibility>
            <show id="my:number" />
            <show id="my:date" />
            <show id="my:name" />
               </field-visibility>
               <appearance>
                  <field id="my:date">
                        <control template="/org/alfresco/components/form/controls/daterange.ftl" />
                  </field>
               </appearance>
           </form>
      </forms>
   </config>
Is ti possible to add to the search form a control (like selectmany.ftl) for searching on those sub content types (ie, my:subdoc1, my:subdoc2, my:subdoc3, …).

Best regards,
Alessandro
2 REPLIES 2

drndivoje
Champ in-the-making
Champ in-the-making
Maybe the simple solution for this is to create new property of my:doc, my:docType which is simple text and have already predefined values as constraint (subdoc1, subdoc2, subdoc3). Add this property into the share-config-custom.xml configuration. All subtypes of my:doc, my:subdoc1, my:subdoc2, my:subdoc3 need to have my:docType set to related value. To set this values for every subtypes you can write onCreate behavior where corresponding values of  my:docType  properties will be set(eg. for my:subdoc1 type set  my:docType  to "subdoc1" ). The second solution for this is to set value to this property explicitly in model (I am not sure about this).
I hope this will help you.

alarocca
Champ in-the-making
Champ in-the-making
Thanks a lot drndivoje.

Your first suggestion works for sure. Probably it complicates a bit the content type management, since new sub-type will require to update the behaviour. Anyway it is a step on.

I will verify soon the second solution (override default value of a property directly on the schema). If feasibile, it will be great.

Have a nice weekend,
Alessandro