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

Copy Issue Picker value(s) to Linked Issue Field Edited

Hi All

Goal: To limit what issue types a user can link my "Feature" issue type too.

Looking for some help, Open to all suggestions. I have scriptrunner & JSU plugins.

I have a scripted field (Issue picker searcher type) called "Link your Issue" on the create screen. The issues available are limited to JQL search.

I now need to copy this value to the Linked Issue field. I have made the field read only and pre-set the link type using a behavior. I dont mind if the value is copied on the create screen using form values or after its created using a post function.

Or I could also have a workflow validator to limit the issue types users can link too

Any help much appreciated

Thanks

Richard 

1 answer

1 accepted

1 vote
Answer accepted

Using behavior is probably the simplest here.

Add the following  server side script on your "Link your issue" field:

def linkedIssuesFld = getFieldById("issuelinks-issues")
def linkInputFld = getFieldById(getFieldChanged())

def inputIssue = linkInputFld.value
if(inputIssue){
linkedIssueFld.setFormValue(inputIssue)
}

Thanks for your quick reply, that works perfectly. Simple and effective! 

@Peter-Dave Sheehan That is great, how to do it with duble issue picker, now if I Have 2 and i select second  issue picker, cleared first and write the second one.

I need 2 link

I think you can just grab the existing value first then add to it as an array.

def linkedIssuesFld = getFieldById("issuelinks-issues")
def linkInputFld = getFieldById(getFieldChanged())

def inputIssue = linkInputFld.value
if(inputIssue){
def linkedIssues = linkedIssueFld.formValue
if(linkedIssues instanceof String){
//if there is only one linked issue, it will be a simple String, we convert to ArrayList with the new value
linkedIssues = [linkedIssues,inputIssue]
} else {
//if there are more than one, it will already be an ArrayList, we just add to it
linkedIssues << inputIssue
}
linkedIssueFld.setFormValue(linkedIssues )
}

Thanks for quick answer ,

Works if it fills in the right order :)

Thanks a lot

Where need to add these script

@Anuradha kumari  these are behaviour scripts on scriptrunner for jira

Suggest an answer

Log in or Sign up to answer
TAGS

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