Multi-valued default

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2016 10:30 AM
In my model (generated by Model Manager), I have a multi-valued custom property with a "list of values" constraint. This works as expected:
Now I want to specify "blue" and "red" as default, rather than blue. The Model Manager won't allow me to do this and a few obvious changes I tried to the XML file don't work:
Is there a way to specify a multi-valued default value?
<property name="mymodel:color"> <title>Color</title> <type>d:text</type> <mandatory>false</mandatory> <multiple>true</multiple> <default>blue</default> <constraints> <constraint name="mymodel:LIST_7bfcaacd-06c9-4c29-8c5e-1277190ac43c" type="LIST"> <parameter name="allowedValues"> <list> <value>red</value> <value>blue</value> <value>green</value> <value>yellow</value> <value>pink</value> <value>purple</value> <value>brown</value> </list> </parameter> <parameter name="sorted"> <value>false</value> </parameter> </constraint> </constraints></property>
Now I want to specify "blue" and "red" as default, rather than blue. The Model Manager won't allow me to do this and a few obvious changes I tried to the XML file don't work:
<default>blue,red</default>
<default>blue</default><default>red</default>
<default> <list> <value>red</value> <value>blue</value> </list></default>
Is there a way to specify a multi-valued default value?
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2016 11:55 AM
Hi lercherl
Out of the box, no I don't think there's an easy way to this. While Alfresco's modelSchema.xsd means that your configuration is valid and would be parseable as a valid model, it looks like Alfresco's Java representation of a Property expects to receive a single String only. So just by content modelling, I don't think so.
There's an alternative option, using a simple Behaviour, where you could programmatically set the color property value of newly created nodes of this type to red and blue (obviously be sure to only set the values if the property is null) - http://docs.alfresco.com/5.1/references/dev-extension-points-behaviors.html
Regards
Steven
Out of the box, no I don't think there's an easy way to this. While Alfresco's modelSchema.xsd means that your configuration is valid and would be parseable as a valid model, it looks like Alfresco's Java representation of a Property expects to receive a single String only. So just by content modelling, I don't think so.
There's an alternative option, using a simple Behaviour, where you could programmatically set the color property value of newly created nodes of this type to red and blue (obviously be sure to only set the values if the property is null) - http://docs.alfresco.com/5.1/references/dev-extension-points-behaviors.html
Regards
Steven
