Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How can i iterate through the values from page.getProperties() in groovy?

Avatar

Level 6

How can i iterate through the values from page.getProperties() in groovy?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Shaheena_Sheikh,

getProperties method returns ValueMap , you can iterate like this:

 

page?.getProperties()?.each { property ->
    println "Property key: ${property?.key}"
    println "Property value: ${property?.value}"
}

 

key represents property key, value represents property value.

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @Shaheena_Sheikh,

getProperties method returns ValueMap , you can iterate like this:

 

page?.getProperties()?.each { property ->
    println "Property key: ${property?.key}"
    println "Property value: ${property?.value}"
}

 

key represents property key, value represents property value.