Derived Data: set multi-valued property

Hello,

i’m using a derived data to set some props of my documents, but i’m not able to set multi-valued property when this property is not present before the derived function runs.

I simply do:
parameters.put(ATTR_KEYS, returnedValues);
where “ATTR_KEYS” is the name of the prop and “returnedValues” is an array of Value objects.

If the prop is already present, it’s work, but when not present, the derived function try to create it but with single-valued, and store only the first element of the array.

How can i fix it?
Enzo

Hi Enzo,

I see that the code behind this only adds a multiple property if there’s a property definition saying it’s a multiple. This is on CND level so kind of an outdated approach. There’s room for improvement I’d say… you’re welcome to create an issue at https://issues.onehippo.com/projects/CMS.

For you now, you should be able to work around it by making sure the documents do have the property already. Think Groovy script initially, adding it to the document’s prototype for new documents.

HTH
Jeroen

Thanks jeroen,

yes, i used a groovy script to create that multi-values prop as a workaround, and added the initial state in the prototype node of its document type.
I also created this issue as you suggest: https://issues.onehippo.com/browse/CMS-12378

Enzo

Glad you have it working.
Thanks Enzo!