1

I'm working with a custom content model and I want to have a custom text field that serves the purpose of a description for the document. I've run into a problem with this field, because it seems I can't have a d:text property with more than 1024 characters.

Is there another property type that allows me to go over this limit? I'm using the content model to describe PDF documents, and these do not always have OCR performed on them, so I need the description field to make them searchable by Alfresco.

Kross
  • 305
  • 3
  • 21
  • 2
    For larger amounts of text, using `d:content` is the normal way - that has no maximum size limit, and the contents can be indexed. Can you not switch to that? – Gagravarr Nov 13 '14 at 05:18

2 Answers2

2

d:text length depends on your database table. So try to increase that and you should be fine.

Teqnology
  • 1,282
  • 8
  • 20
  • I see this would require a database alter, like change de data type length or type to text, wouldn't this break something in alfresco? – David Borges Mar 29 '22 at 00:36
1

It is very simple, to set a bigger limit, than 1024 characters, to a attribute which is from the type "d:text". You must modify the file custom-config-model.xml which you can find in folder ALFRESCO_HOME/tomcat/shared/classes/alfresco/web-extensions.

In the config from your node-type you must write something like in the following example:

    <config evaluator="node-type" condition="your:model">
        <forms>
            <form>
                <field-visibility>
                    ...
                    <show id="your:attribute" />
                    ...
                </field-visibility>
                <appearance>
                    ...
                    <field id="your:attribute">
                        <control template="/org/alfresco/components/form/controls/textarea.ftl">
                            <control-param name="maxLength">40000</control-param>
                        </control>
                    </field>
                    ...
                </appearance>
            </form>
        </forms>
    </config>

The fist thing you do with that code is:

  • You show the attribute
  • You make the textfield to a template which is called textarea (much better for a text or something)
  • you set the maximal length of the attribute to 40.000 characters (which should be enough) If you don't want the textfield as textarea delete the template attribute from the control section.

After this manipulation you can save strings with up to 40.000 characters in this attribute.

Hope I could help you!

Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
Sebastian Rieger
  • 685
  • 5
  • 20