How do I run a js script when performing a transition in a Jira request?

Hello everyone!

I have a Workflow in Jira, there is a transition in this workflow. I want some js code to be executed when the user performs this transition.

As far as I know, it is not possible to configure this using standard functions or using plug-in functionality

All my attempts to create my own plugin end in failure, do you have any ideas how to do it?

Jira Server ver. 9.4.3

There’s really just no hooks for this in the jira frontend. The frontend has no mechanism for executing javascript when a particular transition has just occurred. It would be difficult to workaround this limitation.

Perhaps you explain what your endgame is, which might help shed light on different possibilities.

sfbehnke, thanks for the reply!

What do I want to achieve? In general, I don’t really like the transition setup in the workflow, in terms of validators, transition screens

Of course, we can use all this when designing Workflow, but the functionality itself, as for me, is very scarce and its configuration is very limited

I would like to be able, when making a transition, for example, to open a modal window to the user with some form, the data from which would then be sent to the server and processed there

I understand that you can hang a screen on the transition, add the necessary fields to the screen and then execute an HTTP request in the Post function with the fields submitted. But the problem is that data is often very specific and it is problematic to create some fields unique to all situations, and to produce a lot of fields for each situation is only to clog the database

It would also be great to be able to set up some pop-up notifications, visualize errors in a more beautiful way, and so on.

In general, I would like to be able to work with the UI on a more serious level than it is now

I was hopeful that there would be some workaround based on your described needs, but there’s just no way to satisfy your requirements. The closest possibility would be to add your own customfieldtype that interacted with the customfieldtype api but it would seem you’ve looked into that. It would not let you easily handle multiple form fields nor would it allow you to add additional popups, custom popups, or add different error handling.

It seems your need in particular is to fully replace the Transition/Popup functionality within Jira as it is insufficient for your needs, but there is simply no API with which to do what you would like to do.

Sorry, and good luck with your usecase.