AnsweredAssumed Answered

show associations on both sides

Question asked by jservajean on Dec 12, 2012
Latest reply on Nov 7, 2013 by tomoconnell
I have a type A and a type B.
Type A defines a many-to-one association to Type B.
I managed to customize my edit-metadat form for Type A in a way it shows the picker an let me select a Type B.

Now I'd  like to display the list of Types A associated to Type B in the document-details page or in the edit-metatadata form of type B (resulting on the above association). But I don't know how to easily achieve this.

The code currently looks like below :

In custom-model.xml :
<type name="my:typeA">
   <title>Type A</title>
   <parent>cm:content</parent>
   <associations>
      <association name="my:relatedTypesB">
         <source>
            <mandatory>false</mandatory>
            <many>true</many>
         </source>
         <target>
            <class>drh:typeB</class>
            <mandatory>true</mandatory>
            <many>false</many>
         </target>
      </association>
   </associations>
</type>

<type name="my:typeB">
   <title>Type B</title>
   <parent>cm:content</parent>
</type>

In share-config-custom.xml :
<config evaluator="node-type" condition="my:typeA">
   <forms>
      <form>
         <field-visibility>
            <show id="my:relatedTypesB" />
         </field-visibility>
         <appearance>
            <field id="my:relatedTypesB" label="Related Types B">
               <control template="/org/alfresco/components/form/controls/association.ftl">
                  <control-param name="displayMode">list</control-param>
                  <control-param name="showTargetLink">true</control-param>
                  <control-param name="startLocation">{doclib}</control-param>
               </control>
            </field>
         </appearance>
      </form>
   </forms>
</config>

I tried to had the same kind of control on the Type B form, but it doesn't seem to display automatically the other side of the relationship

Is there an obvious way to do that ?
Does it require a custom query/behaviour to add ?
Thanks for the clue…

Outcomes