It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Event Listener - FormSubmitEvent cant process event

Hello community,

I have a question around how to process an event triggered from a FormSubmitEvent.

I have written a basic event listener in Confluence that fetches the event when triggered and prints out the content of the event object. But it is not working correctly.

My code is as follows:

import com.atlassian.confluence.core.DefaultSaveContext 
import com.atlassian.confluence.event.events.content.page.PageEvent
import org.apache.log4j.Logger

def log = Logger.getLogger("com.team.confluence.listener.createPage")
log.setLevel(org.apache.log4j.Level.DEBUG)
log.debug( "Forms for Confluence Create Page - Entering");

def eventFormSubmission = binding.variables.get("event")
String eventData = eventFormSubmission.structuredValue // This line shots and error


log.debug("Content in event object is: "+eventData)

log.debug( "Forms for Confluence Create Page - Exiting");

 When I add such code I get the following error in the console:

[Static type checking] - No such property: structuredValue for class: java.lang.Object

If I take that line out of my code and print out just the event without utilizing the "structuredValue" property it runs but I cannot see the contents of the event.

import com.atlassian.confluence.core.DefaultSaveContext 
import com.atlassian.confluence.event.events.content.page.PageEvent
import org.apache.log4j.Logger

def log = Logger.getLogger("com.team.confluence.listener.createPage")
log.setLevel(org.apache.log4j.Level.DEBUG)
log.debug( "Forms for Confluence Create Page - Entering");

def eventFormSubmission = binding.variables.get("event")

log.debug("Content in event object is: "+eventFormSubmission )

log.debug( "Forms for Confluence Create Page - Exiting");

The content that is printed in log files is:

com.adaptavist.confluence.forms.model.FormSubmitEvent[source=com.adaptavist.confluence.forms.service.manager.impl.DefaultFormMailRequestHandler@e3ac5b8]

 Has anyone ran into this issue and can anyone provide some pointers on what to do.

I feel like I need to cast my event as a FormSubmitEvent or something of the like but cannot find any object as that.

 

Appreciate any help on this!

Thank you,

-Roberto

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What project did you transition or start on Confluence with the shift to remote work?

It’s been great to hear from fellow users over the last few weeks about the best tips and fun moments you’ve had working on Confluence since the transition to working remote. I’d love to keep the c...

109 views 3 7
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you