


How can I update multi valued property using groovy, ex: cq:rolloutConfig is of String[] and i want to add values to this field using groovy.
Views
Replies
Sign in to like this content
Total Likes
Hi @Shaheena_Sheikh,
In groovy you can use code like this:
Property property = node.getProperty("cq:rolloutConfig")
if (property?.isMultiple()) {
String [] values = property?.getValues() as String []
if(values) {
values += "new value"
node?.setProperty("cq:rolloutConfig", values)
save()
}
}
Hi @Shaheena_Sheikh,
In groovy you can use code like this:
Property property = node.getProperty("cq:rolloutConfig")
if (property?.isMultiple()) {
String [] values = property?.getValues() as String []
if(values) {
values += "new value"
node?.setProperty("cq:rolloutConfig", values)
save()
}
}