Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Event Listener - FormSubmitEvent cant process event

Roberto L
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 4, 2019

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

1 answer

0 votes
Sven Alebrand August 4, 2020

Hey Roberto!

 

Did you come up with a solution to this? I ran into the same problem.

 

Thank you,

Sven

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events