Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira scriptrunner - Listener

Emanuel Konringer August 14, 2019

I have written a script for scriptrunner, and the code is okay (executable and it also works in the console), it just won't work as a Listener listening to the "Issue Created"- event.

I have also already identified the problem, however I do not know how to fix it: I want my script to automatically perform an action once the user submits a form, and the forms data to be read. All of this is already implemented and works, but the occurence of the complications are displayed once the code is put into said Listener: The event is triggered before the form is submitted, hence the script is unable to read all the necessary data.

Is there any way to get around this (i.e. an event that is triggered once everyting is fully loaded or delaying th listener.). I hava already tried to make a workaround with a script that updates the submitted request by setting an assignee, but this approach fails for the same resons (You cant assign anyone to a request that doesn't exist yet).

 

Kind regards

2 answers

1 accepted

0 votes
Answer accepted
Emanuel Konringer August 19, 2019

So it does not work with pure scriptrunner.

I figured out it was the best to make an Automation rule which progresses the workflow and then to listen (with scriptrunner) on the events. You'll have to make the listener listen on generic events.

After applying the changes, everything works as it's supposed to, i.e. it gets the data from a form, but it's still just a workaround.

Emanuel Konringer August 23, 2019

UPDATE:

With pro forma it is possible to make such rules and no extra plugin is needed. (When you're editing a form and then go to the form's settings, you can select "Add Rule" in the Form Automation section.

0 votes
Tarun Sapra
Community Champion
August 14, 2019

Hello @Emanuel Konringer 

Can you please share more details about what kind of event if being triggered. And what kind of form you are submitting and exactly when do you want the event to be triggered?

Emanuel Konringer August 14, 2019

Hi!

Thanks for your answer!

The form was built using pro forma and should resemble a service request (it has fields with certain values).

I want the action to be triggered once the form has been submited and (this hould happen autmatically by default) has been attached to the JIRA issue. The problem appears to be that the script is called before the request is created. Therefore it tries to access data which hasn't even been published. I need some way to wait until everything is in place and NOT the script to be executed when the user clicks on "Create" (when raising the request), but rather once the request is ready to go (immediately after creating the request).

The event is called "Issue Created".

Suggest an answer

Log in or Sign up to answer