Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

2 answers

1 accepted

0 votes
Answer accepted

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"...

Loooong time delay on this particular ask, but I have accomplished what you are asking to do (in a way) in a bit of a hacky manner... Consider adding a loop transition (a transition from a status back to itself) that has the screen that you want to appear (prompting the user to fill in certain details). Then go to the create transition and add two post-functions... one being the pre-set data you want populating the fields automatically (since this is back-end as @Nic Brough _Adaptavist_ is stating), but then have another post-function (LATER in the order of post-functions as it executes in order) that calls the transition you created above. This will then pop the front-end entry screen you desire, but still have the issue end at the status you desire.

NOTES: This is not a super clean way to do it, but I have used these loop transitions for this purpose before and it gets you what you're looking for. Also, you must be certain what transition ID you are calling on this post-function (ESPECIALLY when adding this post-function on a Create transition) as if you accidentally call the CREATE transition (or some OTHER transition that employs the CREATE transition) you can create a loop statement and create a massively impressive number of tickets as fast as your little server's heart can pitter-patter until it ultimately dies or catches fire... Please don't set your server on fire!!!! (Especially don't set the server on fire if you're on Cloud!!!!!) 

Hope this is still relevant and helps!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Do Not Lose your Customer’s Trust

Missing deadlines is one of the biggest problems every team lead wants to avoid when dealing with managed services. When the customer contracts your company to help with IT services it is expected th...

24 views 0 0
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you