cancel
Showing results for 
Search instead for 
Did you mean: 

Association Datalist - Document

a_fregoli
Champ in-the-making
Champ in-the-making
Hi guys,

In a project in Alfresco / Share, I would like to insert into a document an association of one or more elements from a datalist, but the result I get does not allow me to select the items of the datalist because I just get the values ​​of the id.

My model is


<type name="bcp:rubrica">
   <title>Rubrica </title>
   <description>Rubrica</description>
   <parent>dl:dataListItem</parent>
   <properties>
      <property name="bcp:nominativoRubrica">
         <title>Nominativo</title>
         <type>d:text</type>                     
      </property>
      
      <property name="bcp:telefonoRubrica">
         <title>Telefono</title>
         <type>d:text</type>                     
      </property>
      
      <property name="bcp:cellulareRubrica">
         <title>Cellulare</title>
         <type>d:text</type>                     
      </property>
      
      <property name="bcp:emailRubrica">
         <title>email</title>
         <type>d:text</type>                     
      </property>
   </properties>
</type>

<aspects>
   <aspect name="bcp:protocollatiAspect">
      <title>Protocollo </title>
      <properties>
         <property name="bcp:numeroProtocollo">
            <title>Numero Protocollo</title>
            <type>d:text</type>
            <mandatory>false</mandatory>
         </property>
      </properties>
      
      <associations>
         <association name="bcp:mittenteDest">
            <source>
               <mandatory>false</mandatory>
               <many>true</many>
            </source>
            <target>
               <class>bcp:rubrica</class>
               <mandatory>false</mandatory>
               <many>true</many>
            </target>
         </association>
      </associations>
   </aspect>      
</aspects>   


In share I modified the configuration file of the form by entering the control of the association.


<field id=" bcp:mittenteDest " label="Mittente / Destinatario">
   <control template="/org/alfresco/components/form/controls/association.ftl" >
   </control>
</field>


Solutions ?
2 REPLIES 2

parzgnat
Star Contributor
Star Contributor
Unfortunately datalist items are named based on a unique ID rather than the name that you give to the datalist item.  This is so that you don't run into issues with duplicate names, because Alfreso does not allow two items with the same name to exist in the same folder.  My suggestion would be to create a custom association.ftl control.  Because the association.ftl control calls the picker javascript component, you'd need to modify that component to display the correct field, rather than the cm:name of the node.

Another option is that if you're OK with not being able to create duplicates, you could write a behavior that automatically renames your datalist items when they're created so that they have a human-readable name instead of an ID.

a_fregoli
Champ in-the-making
Champ in-the-making
Thank Parzgnat

I have followed your suggestion and I used the name [cm: name] whereas in my book there are no duplicates.

How do I select items in the phonebook?

In fact, the symbol "+" to select the users is not shown.