How to get a workflow postfunction to show the "Create Issue" screen with pre-filled values?

By following the instructions given at https://confluence.atlassian.com/jirakb/creating-issues-via-direct-html-links-159474.html I have been able to have a "Create Issue" screen shown as effect of a workflow post-function.

However, the beginning of the link above states that

Please note that the content on this page is not maintained as a supported component of JIRA applications. Consequently Atlassian cannot guarantee to provide any assistance in configuring or implementing it.

We recommend using the JIRA REST API instead of following the steps on this page, as the content is now quite outdated. Please see our JIRA REST API Tutorials for further information.

As far as I am aware, what I want to do cannot be achieved using the REST API.
Is this correct?

If so, what "maintained" method would you suggest me to use in place of that mentioned in the link above?

Thanks

1 answer

1 accepted

This widget could not be displayed.

This seems a little confused as you mention "post functions" a couple of times, but in the wrong context and suggesting that they are doing things that they simply can't.

A post-function is a chunk of code that executes after a transition is committed.  Any transition (including create) will go through things in this order:  Conditions (to check the user can do it), present screen if appropriate, validate entry, then finally the post-functions.  So, post-functions have nothing to do with filling in fields - they happen well after you've finished with the screens and fields.

The REST API does not pre-fill things either.  It does not use the UI, so there is nothing there to be pre-filled.  You can use it for creating issues, and if you do, your code can be written to fill in defaults if you want.  But there's nothing to do in JIRA here, you fill in the defaults in your call.

The doc you have pointed to is about pre-filling values in an html call.  If that is still what you are trying to do, then the method works, but it's still going to be a case of coding in the call to fill values, you're not doing anything in JIRA.



Hi Nic, my intention is to have a post-function that prompts the screen for creating a new issue and prefills it as well.

Again, a post-function is part of a transition, and it happens at the end.  It's too late to do anything with the screen. 

Even if it were not, post-functions are not for doing front-end things, they don't have any way to trigger any activity for the user.

If you want to land the user in a "create new issue" screen after a transition (which is probably a bad idea as most users wouldn't expect or want to land there after doing something to another issue), you will need to either hack the core code which currently lands them in a certain place (which differs according to where you're doing it) or write something that can catch "landing on the screen after transition" and jump to the create screen.  The second option is going to need to be some form of javascript that runs in the browser.

 

Hi Nic. Eventually I got it. I believe that I can get what I want by means of a custom web-item. Thanks.

 

The way I do this is using a web item which leads to a https://scriptrunner.adaptavist.com/latest/jira/fragments/CreateConstrainedIssue.html

Optionally you can then have the create transition of the new issue action the issue you are creating it "from"...

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

510 views 3 18
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you