we have tag cq/gui/components/coral/common/form/tagfield.
it was created to select only one field. now its a requirement to change to select multi.
Issue is already existing selected tags.
how to migrate crx content which is stored as single field as string to string array (string[]) ?
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
@SudarshanV1 No need to change the resourcetype TYPE to String[].
Just add this property in the node.
propertyName - multiple
PropertyType - Boolean
PropertyValue - True.
This will allow the tags field to accept multiple tag values.
The issue is, how to migrate already stored values? we are not worried about conversion from single to multi.
Hi Sudarshan,
If i understood correctly, you need to update already created content.
you shall use AEM fiddle script. Please refer below post -
Thanks,
Raju.
You can create a Groovy script to update the existing property type to string[].
if (property.isMultiple()) {
println "Property already a String[] at ${node.path}"
} else {
def value = property.getString()
def newValues = [value] as String[] // Convert the single value to a String array
node.setProperty(propertyName, newValues)
println "Updated property at ${node.path} from String to String[]"
}
You may need to remove the property first after reading the value and set again as we are updating the type from String to String[]
Views
Likes
Replies
Views
Likes
Replies