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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

1 answer

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
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

402 views 23 8
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