Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Convert a scripted multiple select issue picker field to a linked issue

I am in charge of an internal IT helpdesk and an external customer support project. Sometimes one of the customer support requests will need to be handled by our IT dept so someone on our support team will put in a helpdesk request. More rarely, several support requests will be related to one helpdesk ticket. Since you can't put the "Linked issues" field on the customer portal, I wanted to use a scripted multi-select issue picker. The only problem with that is that it only provides a single direction link. I've figured out how to copy the value of my scripted issue picker to the linked issues field using automation, but it only works it there's only one issue picked.

I've seen what I think might be at least partial solutions to my problem (https://community.atlassian.com/t5/Jira-questions/Copy-Issue-Picker-value-s-to-Linked-Issue-Field/qaq-p/1112392) but as a ScriptRunner/programming novice, I have no idea how to begin implementing it. Is there someone out there who can help?

1 answer

0 votes

I don't think that this solution will help you.

I think a Scripted Listener will be better suited.

Project Automation configs are a form of listeners. When EVENT then do ACTION.

So, we can do the same thing with the scripted listener.

From your scriptrunner admin screen, go to the Listener Tab

Click create listener, then select Custom listener

Pick the project (JSM) where the initial issues are getting created.

Select the Evens: Issue Created

This is the code you need, just adjust lines 7-9

import com.atlassian.jira.issue.IssueImpl
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkTypeManager
def issueLinkManager = ComponentAccessor.issueLinkManager
def issueLinkTypeManager = ComponentAccessor.getComponent(IssueLinkTypeManager)

def issuePickerFielId = 123456
def runAsUsername = 'admin' //your portal users probably don't have permission to link issues
def linkTypeName = 'Dependency'

def issuePickerCf = ComponentAccessor.customFieldManager.getCustomFieldObject(issuePickerFielId)
def issuesPicked = event.issue.getCustomFieldValue(issuePickerCf)

def runAsUser = ComponentAccessor.userManager.getUserByName(runAsUsername)
def linkType = issueLinkTypeManager.getIssueLinkTypesByName(linkTypeName)[0] //this assumes only one with that name
issuesPicked.each{IssueImpl pickedIssue->
issueLinkManager.createIssueLink(event.issue.id, pickedIssue.id, 1L, linkType.id,runAsUser)
}

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

315 views 9 7
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