aspect property in advance search form

cancel
Showing results for 
Search instead for 
Did you mean: 
mtsiak
Active Member II

aspect property in advance search form

Jump to solution

I cannot manage to appear a property that belongs to an aspect in advance search

 

My custom type is `mySmiley TongueDocument`, and my custom aspects are `my:abstractPable` and `my:incomingP`

 

<!-- customModel.xml -->
<type name="mySmiley TongueDocument">
    <title>p document</title>
    <parent>cm:content</parent>
    <mandatory-aspects>
        <aspect>my:abstractPable</aspect>
        <aspect>cm:classifiable</aspect>
    </mandatory-aspects>
</type>

<aspect name="my:abstractPable">
    <title>Abstract P able</title>
    <properties>
        <property name="mySmiley TongueNumber">
               <type>d:int</type>
               <mandatory>true</mandatory>
               <index enabled="true">
                 <atomic>true</atomic>
                 <stored>false</stored>
                 <tokenised>false</tokenised>
                 <facetable>true</facetable>
               </index>
        </property>
        ....

<aspect name="my:incomingP">
    <title>Incoming P doc</title>
    <parent>my:abstractPable</parent>
    <properties>
        <property name="mySmiley SurprisedriginP">
               <type>d:text</type>
               <index enabled="true">
                 <atomic>true</atomic>
                 <stored>false</stored>
                 <tokenised>false</tokenised>
               </index>
        </property>
        ...

I have configured AdvancedSearch:

<!-- share-config-custom.xml -->
<config evaluator="string-compare" condition="AdvancedSearch">
    <advanced-search>
        <forms>
            <form labelId="type.my_pDocument" descriptionId="type.my_pDocument">mySmiley TongueDocument</form>
            ...

How should i configure the search form in order to appear `mySmiley SurprisedriginP` property?

1 Solution

Accepted Solutions
angelborroy
Alfresco Employee

Re: aspect property in advance search form

Jump to solution

I wrote about this at Alfresco Share – Customize advanced search for aspect properties | Programming and So 

Probably easier alternative is to include force="true" in your field-visibility tag.

Hyland Developer Evangelist

View solution in original post

7 Replies
angelborroy
Alfresco Employee

Re: aspect property in advance search form

Jump to solution

I wrote about this at Alfresco Share – Customize advanced search for aspect properties | Programming and So 

Probably easier alternative is to include force="true" in your field-visibility tag.

Hyland Developer Evangelist
mtsiak
Active Member II

Re: aspect property in advance search form

Jump to solution

the force="true" works. 

I am also setting some appearance configurations, but they does not seem to be used?

E.g. i am setting the daterange.ftl control template in a date field, and the form show the standard edit date template. Any ideas? thank you again.

angelborroy
Alfresco Employee

Re: aspect property in advance search form

Jump to solution

No clue at this side. Can you provide the XML fragment for Advanced Search and Search Form Definition?

Hyland Developer Evangelist
mtsiak
Active Member II

Re: aspect property in advance search form

Jump to solution

it is something like:

<config replace="true" evaluator="string-compare" condition="AdvancedSearch">
        <advanced-search>
            <forms>
                <form id="custom-search" labelId="advsearch.label.custom" descriptionId="advsearch.description.custom">cm:content</form>
            </forms>
        </advanced-search>
</config>
<config evaluator="model-type" condition="cm:content">
    <forms>
        <form id="custom-search">
                <field-visibility>
                    <show id="cm:name" force="true" />
                    <show id="cm:title" force="true" />
                    <show id="cm:description" force="true" />
                    <show id="my:aDate" force="true" />
                    ...
                    <appearance>
                        <field id="my:aDate" label-id="prop.my_aDate">
                            <control template="/org/alfresco/components/form/controls/daterange.ftl"/>
                        </field>
                        ...
                    </appearance>
                </field-visibility>
            </form>
    </forms>
</config>
mtsiak
Active Member II

Re: aspect property in advance search form

Jump to solution

so not cool: just noticed that appearance is wrongly inside field-visibility. this was the mistake.. sorry to bother you again!


					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
douglascrp
Advanced II

Re: aspect property in advance search form

Jump to solution

I was going to point that, and I think it would be nice if you actually shared here what exactly you changed, as this may be used as a reference for someone finding this thread in the future.

mtsiak
Active Member II

Re: aspect property in advance search form

Jump to solution

I followed the 'Alternative workaround' of @ Angel Borroy post:

Alfresco Share – Customize advanced search for aspect properties | Programming and So 

In our custom module (share and repo), where our custom model is defined,

at  \my-amp-share\src\main\resources\META-INF\share-config-custom.xml

we override the AdvancedSearch

<config replace="true" evaluator="string-compare" condition="AdvancedSearch">
        <advanced-search>
            <forms>
                <form id="custom-search" labelId="advsearch.label.custom" descriptionId="advsearch.description.custom">cm:content</form>
            </forms>
        </advanced-search>
</config>
<config evaluator="model-type" condition="cm:content">
    <forms>
        <form id="custom-search">
                <field-visibility>
                    <show id="cm:name" force="true" />
                    <show id="cm:title" force="true" />
                    <show id="cm:description" force="true" />
                    <show id="my:aDate" force="true" />
                    ...
               </field-visibility>
               <appearance>
                     <field id="my:aDate" label-id="prop.my_aDate">
                         <control template="/org/alfresco/components/form/controls/daterange.ftl"/>
                     </field>
                 ...
                </appearance>
            </form>
    </forms>
</config>

at \my-amp-share\src\main\amp\config\alfresco\module\my-amp-share\messages\customModel.properties we define the labels, e.g.:

prop.my_aDate=a Date

(the resourceBundles should be referenced in the my-amp-share\src\main\amp\config\alfresco\web-extension\content-model-context.xml)

at \my-amp-core\src\main\amp\config\alfresco\module\my-amp-core\model\customModel.xml

the custom aspects are defined.