Hi @sai_charanar ,
Try below solution:
Groovy Console (Author-only)
The most effective and safe way—without manual editing or full republishing—is to use the AEM Groovy Console on Author to update the JCR nodes programmatically.
Sample Groovy Script
Adjust the following script to your specific paths, component type, and field name:
import javax.jcr.query.Query
import org.apache.sling.api.resource.ModifiableValueMap
def DRY_RUN = true
def QUERY = """
SELECT * FROM [nt:unstructured] AS s
WHERE ISDESCENDANTNODE([/content/your-site-path])
AND s.[sling:resourceType] = 'your/components/mycomponent'
AND s.[newField] IS NULL
"""
resourceResolver.findResources(QUERY, Query.JCR_SQL2)?.each { resource ->
def valueMap = resource?.adaptTo(ModifiableValueMap)
if (valueMap) {
valueMap.put("newField", "defaultValue")
println "Updated: ${resource.path}"
if (!DRY_RUN) {
resourceResolver.commit()
}
}
}
Note:
- Run this on Author only
- Never run Groovy Console on Publish
- Use DRY_RUN = true first to preview the paths
- After verification, set DRY_RUN = false and commit
- Use Manage Publication to push updates to Publish
Why Not Just Configuration?
Unfortunately, AEM doesn’t provide an out-of-the-box config-only way to backfill dialog field values on existing nodes. Dialog fields reflect persisted properties—so if the field wasn’t authored before, it won’t appear unless either:
- The dialog definition includes a defaultValue (shown but not persisted), or
- The value is saved to JCR explicitly (e.g., via this script)
Regards,
Amit