I have created a custom web item in the form of a button using script fragments.
I require this button when clicked to load a Jira screen that is not set to any of the default actions (Create, Edit or View).
In theory this shouldn't be too hard as the feature described works with workflow transitions however I can not seem to get anything to work or find anything on the internet.
Does anybody have a solution that will allow me to link my button to a screen?
I know that it seems like it would not be all that hard ... but scriptrunner doesn't implement the same type of webwork actions that the built-in jira does.
So, what you would need to do, it using 100% custom groovy code, access the screen definition object to find the list of custom fields.
Then for each custom field, lookup the field type so you can prepare what the html UI will look like.
You'll probably need to look up some other configurations from the project such as the field configuration (maybe some fields on your screen should be hidden or required).
And then using all this, construct a custom htmls form using all the correct template for each of those fields.
Ah, and don't expect scriptrunner behaviours to be active. They won't.
The simple alternative, add a workflow transition from: "Any status" to: "itself". Associate the screen you want. Give the transition the name you want to see on the button.
Bonus features: you can use condition, validators and post functions.
This type of transition will not change the status and do exactly what you want.
The only downside is you might have to add this to multiple workflows.
For context we are looking to Clone tickets into projects based on a project value selected.
So I initially setup a test scenario using the workflow transitions and screens. I then created an automation rule however this would not work as there appears to be a bug which stops Insight custom fields from cloning.
I then looked into scriptrunner and setup the Listener that will clone a ticket. This copies all fields and works as expected, with one issue. Updating the field from the workflow transition screen appears to bypass the listener. Meaning I would have to add 4/5 post-function scripts to each workflow.
Do you know if there is a specific event I need to add for this? Currently I have it set to issue updated and condition is looking at the specific field (It works if I edit through the edit screen directly)
I use Clone Plus for this purpose: https://marketplace.atlassian.com/apps/44043/clone-plus-for-jira?hosting=server&tab=overview
You would probably spend more on consultancy fees to achieve the same purpose that that plugin would cost over the next 5 years.
Another option would be our Jira cloud app Deep Clone for Jira.
From a developers perspective I agreee with @Peter-Dave Sheehan. Cloning and especially moving to other projects is not as trivial as it might seem :)
If you're interested in reading more about automate cloning with Deep Clone for Jira, you can have a look at our documentation:
I want to clarify with you when you mentioned:-
I require this button when clicked to load a Jira screen
Do you want a dialog to appear went the Button is clicked?
Also, could you please share the current code and configuration that you are using?
Thank you and Kind Regards,
If you have a transition with a screen behind it, when the button is clicked it will load up the screen and allow you to edit fields in that screen.
I would like my button to have the same behaviour, when clicked it loads a screen/dialog that allows me to edit values of fields and submit, changing the values in the ticket.
Looking at another answer this appears like it could be a bit of a headache to implement unfortunately.