Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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 copy value from custom field and add it to Issue Links as a Web link?


I have a custom field that is used to pick from a list of change tickets. Can I somehow automate via script so that when a user selects a value in custom filed, that value (an url to another ticket in another tool) is added to Issue Links as a "links to" Web link?

I am a total newbie to Jira and had no luck using GUI to automate this, Would really appreciate some help with script automation. Thank you!

1 answer

1 accepted

1 vote
Answer accepted
Antoine Berry Community Leader Jan 03, 2022

Hello @Mihailo ,

If you are using ScriptRunner you could use a script listener on the issue updated event (and any other event that might be triggered when you select a value). This is assuming that the field is a select list : 

import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()

def fieldChanged = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == "Select List Field"}

if (fieldChanged) {
def selectListId = 12200
def customField = customFieldManager.getCustomFieldObject(selectListId)
def customFieldValue = issue.getCustomFieldValue(customField).getValue()

RemoteIssueLink link = new RemoteIssueLinkBuilder().issueId(issue.getId()).url(customFieldValue).title(customFieldValue).build();
ComponentAccessor.getComponent(RemoteIssueLinkManager.class).createRemoteIssueLink(link, ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser());

replace "Select List Field" with the name of your field and 12200 with id id of your field. 

Hope that helps.

Thank you so much @Antoine Berry ! I created a working Listener using your code.

Is it possible to modify it to accept multiple selections? Something like a for Each?

Antoine Berry Community Leader Jan 07, 2022

Hi @Mihailo ,

You mean you are using a multiple values select list, and would like to create a link for each value ?

Yes, that would be possible by iterating on the custom field value.

Yes, that is exactly what I need. Do you have some links on iterating in ScriptRunner?

Suggest an answer

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

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

55 views 0 1
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