Solved
How can I update multi valued property using groovy
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.
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.
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()
}
}Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.