How do i use association.ftl for custom values

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

How do i use association.ftl for custom values

We have a list of keywords say - mobile, order_status,other etc as shown below.

This is how the field is displayed in the form now. This is a multi select list. The list keeps on growing and it becomes less  user friendly to select. I want this keywords to be displayed with a picker list(something like implemented for tags). How do i do it? i checked association.ftl but it lists the repository as the items to select. How do i customize it to show list of keywords?

7 Replies
angelborroy
Alfresco Employee

Re: How do i use association.ftl for custom values

How about using a Category for that?

You can use category.ftl control and maintain the values in Admin section.

Hyland Developer Evangelist
ashwin_mor
Member II

Re: How do i use association.ftl for custom values

Hello,

In share config custom, you can have default path of a repository folder to be displayed. 

You can achieve this by defining say a drop down folder in repository and add all the keyword items with a custom type. You can have content model define association with custom type. 

Let me know this is helpful.

udayakumar_p
Active Member

Re: How do i use association.ftl for custom values

Hi,

I tried your suggestion by adding config as below.

<field id="common:keywords" >
   <control template="/org/alfresco/components/form/controls/category.ftl" >
  <control-param name="parentNodeRef">workspace://SpacesStore/440e96e5-f6d6-45b0-8c3d-9a1ea99fb88d</control-param>
</control>
</field>

This picks up the popup, starting with the custom category list I added, however when creating the content, it sets the noderef value as the value of the keyword property(i.e. instead of setting the text value to the keyword, it sets something like workspace://SpacesStore/440e96e5-f6d6-45b0-8c3d-9a1ea99fb5e0). This violates because the property keywords has a constraint which allows only a set of values. The value should be set as comma separated list of keywords that we have defined.

How do i configure the form to set the value as comma separated list of keywords that we select instead of passing the noderef.

Can you provide more insight on how to configure the category.ftl to set value correctly.

angelborroy
Alfresco Employee

Re: How do i use association.ftl for custom values

You have to use type "d:category" for your "keywords" property in Content Model.

Hyland Developer Evangelist
udayakumar_p
Active Member

Re: How do i use association.ftl for custom values

Same issue even after changing to d:category. Not sure if we need to perform full reindex of solr

angelborroy
Alfresco Employee

Re: How do i use association.ftl for custom values

Yes, re-indexation is required. And also value re-assignment, as category stores a node ref pointing the value but not the real value.

Hyland Developer Evangelist
udayakumar_p
Active Member

Re: How do i use association.ftl for custom values

How to do value re-assignment?