10-08-2018 01:41 AM
I cannot manage to appear a property that belongs to an aspect in advance search
My custom type is `myDocument`, and my custom aspects are `my:abstractPable` and `my:incomingP`
<!-- customModel.xml -->
<type name="myDocument">
<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="myNumber">
<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="myriginP">
<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">myDocument</form>
...
How should i configure the search form in order to appear `myriginP` property?
10-08-2018 07:01 AM
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.
10-08-2018 07:01 AM
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.
10-24-2018 07:09 AM
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.
10-24-2018 08:32 AM
No clue at this side. Can you provide the XML fragment for Advanced Search and Search Form Definition?
10-24-2018 09:01 AM
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>
10-24-2018 09:15 AM
so not cool: just noticed that appearance is wrongly inside field-visibility. this was the mistake.. sorry to bother you again!
10-24-2018 09:31 AM
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.
10-25-2018 02:16 AM
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><field id="my:aDate" label-id="prop.my_aDate">
<appearance>
<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.
Explore our Alfresco products with the links below. Use labels to filter content by product module.