Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Values from issue picker into Issue

Kay Domschke August 6, 2021

I would like to solve the following challenge.

I have a project A in which there are issues A.
I have a project B in which there are issues B in the sense of items in a catalog with a price.

Now I have created a scripted field of the Issue Picker type with the Scriptrunner with which I can select Issue B in Issue A. Up to this point it works very well.

When I have selected the Issue B I was looking for, I would like to transfer 5 fields to Issue A.

Unfortunately I fail at that.

1 answer

1 accepted

0 votes
Answer accepted
Martin Bayer _MoroSystems_ s_r_o__
Community Champion
August 6, 2021

Hi @Kay Domschke I would do it with a postfunction. In more details

  • you need to have the new issue picker field present on Create screen or any transition screen (you can't use it on standard Edit screen because post function is not invoked, you could solve it with listener in this case]
  • you will adjust your workflow and put scripted postfunction to it (https://scriptrunner.adaptavist.com/latest/jira/tutorials/scripted-post-functions-tutorial.html)
  • you will write script which loads value of your issue picker field -> it will return an issue B
  • then you will load values from the 5 fields from issue B
  • you will set them to issue A

You can try to write some script and we can consult it step by step?

Kay Domschke August 9, 2021

I'll try my very best, first Idea was to include it into the scripted Issue Picker, but guess that won't work.

Martin Bayer _MoroSystems_ s_r_o__
Community Champion
August 9, 2021

Hi @Kay Domschke , you still need Issue Picker field. The task is "to copy data from issue B to issue A". Issue picker field provides an issue instance, I guess it is ok... you need to implement the function which happens after the form is saved.

Kay Domschke August 10, 2021

Hi @Martin Bayer _MoroSystems_ s_r_o__ 

Wouldn't a listener also be a good option, which would be fired after the issue edit?
I would not like to tie it to the status of an issue, rather to a change in an issue.

Is my train of thought wrong?

Martin Bayer _MoroSystems_ s_r_o__
Community Champion
August 10, 2021

Hi @Kay Domschke yes, you can use listener, but I don't like it because of performance. It is not probably the problem for smaller instances but I'm programmer so I want the code to be only executed when it is really needed...that's why I use postfunctions most of the time.

If you're on DC or your instance is not big, you can use listener :)

Kay Domschke August 10, 2021

Perfect, I'll follow the way of Listener. Will create a proposal and post ist.

Martin Bayer _MoroSystems_ s_r_o__
Community Champion
August 10, 2021

Sure, keep me updated :) good luck

Kay Domschke August 11, 2021

Now i solved it by a bahavior. Works fine. I found some code in the library and was able to adapt it.

Martin Bayer _MoroSystems_ s_r_o__
Community Champion
August 11, 2021

Nice, good job. Did my answer help you a little or did you make it on your own?

Kay Domschke August 12, 2021

thanks a lot, you guided me in the right direction. Then I founded this and that help me finaly: https://library.adaptavist.com/entity/set-form-field-values-from-issue-in-picker

Suggest an answer

Log in or Sign up to answer