Expand my Community achievements bar.

SOLVED

cq5.6 the event listener does not detect the from submitted node properties

Avatar

Level 2
I have to submit a form  data to "/content/usergenerated" and on the node we store few properties like formpath and formtype. 
We are using eventlistener which used to created few properties based on this node properties. I see that if check in the below code fails for the properties.
 
In cq5.5 the below code used to work with eventlisterner used to detect the properties of form submit node. I see the same code is not working in CQ5.6.1 any suggestions
 
 
public void onEvent(EventIterator events) {
while (events.hasNext()) {
Event event = (Event) events.next();
try {
String path = event.getPath();
if (StringUtils.isNotEmpty(path)) {
if (event.getType() == Event.NODE_ADDED) {
Node nde = resolver.getResource(path).adaptTo(Node.class);
if (nde != null && nde.hasProperty("formpath") && nde.hasProperty("formtype")
&& nde.hasProperty("email")) {
.......
}
 
}
}
} catch (RepositoryException e) {
log.error("UserFormsListener path: " + e);
}
}
 
}
 
Thanks,
Srinivas
 
 
 
 
1 Accepted Solution

Avatar

Correct answer by
Level 10

AT high level look right to me.  Make sure your custom enable property is configured in 5.6.1 

View solution in original post

3 Replies

Avatar

Level 10

it should work, are you seeing any error in logs.  Post entire class rather than method for review.

Avatar

Level 2

I have added entire class as attachment .please let me know if I have missed out anything.

Avatar

Correct answer by
Level 10

AT high level look right to me.  Make sure your custom enable property is configured in 5.6.1