ScriptRunner request type and listener for transitions

Daniel Alonso June 1, 2022

Hi,

Sorry that I created a discussion instead of a question, but the questions portal is not working.

I have two simple questions, but I couldn't find any documentation to help me solve them:

1. How can I create a Request with Customer Request Type (JSM)

2. How can I catch a transition with Script Listeners?

Any help is well appreciated, thank you.

Daniel

2 answers

1 accepted

1 vote
Answer accepted
Daniel Ebers
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.
July 31, 2022

Hi @Daniel Alonso

for the first question ("How can I create a Request with Customer Request Type (JSM)") you might find some ideas online - however they are mostly suited for Jira Server.

Please be noted the syntax for ScriptRunner on Jira Cloud is different from the one for Jira Server. Therefore, code snippets available online do not apply.

Additionally, communication between an App, like ScriptRunner, and Jira is done via REST API on Cloud. That means, additionally to some coding experience you might need to figure out where to look and what to do next.

A start could be:

However, if you are new to all of this, support of an experienced developer might something to ask for.

For the second question ("How can I catch a transition with Script Listeners?"): for Script Runner in Jira Cloud it is not possible to use a listener on a custom event, but there is a Suggestion open for that with Adaptavist:

Some longer explanation: if there would have not been that restriction you would just need to create a new Event (that is perfectly possible in Jira Cloud), modify a Post Function in the workflow of your choice to let it work with that Event (instead of a generic, default one). After that you would just need to let ScriptRunner work with that Event in the Listener of your choice.
Like said, this is more of an explanation only because that way it works in Jira Server, currently not in Jira Cloud.

Cheers,
Daniel

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 2, 2022

Hmm, odd, what do you mean by "not working"?   The questions portal is the same thing as the discussions, it's just a different type of post in a (hidden) field.  I'm just curious, if you have a problem with Community posts, the Atlassian Community team will want to know, to see if they can fix it.

Anyway, back to the question:

1. I'm not sure what you are asking about here.  The easy answer is "log in as a customer, click create, and fill in the fields", but I suspect you're asking about something else.

2. Transitions fire events.  Listeners listen for events and do things when they catch them., so all you need to do to "catch a transition" is set up your listener to listen for the right event!

Daniel Alonso June 3, 2022

Hi Nic,

About the community error, it just keeps loading forever:

Screen Shot 2022-06-03 at 12.47.35 PM.png

I already tried clearing the cache, different browsers (FF, Safari, Chrome, Chrome Mobile) and I have the same issue

About my questions:

1. *How can I create a Request with Customer Request Type (JSM)* with Script runner, both questions were related to ScriptRunner. I want to do it first in the Console, then implement the code in a post function or a Script Listener.

Clarifying my question here: I want to create a Request including the Customer Request Type, I already have the code to create a regular issue, but I couldn't find a way to add the Request Type, hope it helps.

2. In the listeners I just found 'Issue Created' and 'Issue Updated', I'm guessing that the Event I need is 'Issue Updated', but this even can be triggered when the user updates a field, transition, change the assignee, etc. My question here is if there's a way to filter all Update events but 'Transition'.

Thank you, I'm a big fan BTW :)

Suggest an answer

Log in or Sign up to answer