Very easy with Adaptavist Scriptrunner / Groovy Scriptrunner

  • Create a new field of type “Script Field Scriptrunner”
  • Then go to “cog icon” –> Add-ons –> SCRIPTRUNNER –> Script Fields
  • Select “Template” HTML
  • Then in the script line add a code like this:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.IssueFactory
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.project.Project
import com.atlassian.jira.user.util.UserUtil
import com.atlassian.jira.issue.customfields.CustomFieldType
import com.atlassian.jira.issue.customfields.*
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.index.IndexException
import com.atlassian.jira.ManagerFactory
import com.atlassian.jira.user.util.UserUtil
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.fugue.Option
import org.apache.log4j.Category
import com.atlassian.jira.issue.issuetype.IssueType
import com.atlassian.jira.issue.link.IssueLinkType
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.link.IssueLinkTypeManager
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.plugin.PluginAccessor
import com.atlassian.fugue.Option
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.util.IssueChangeHolder
import com.opensymphony.workflow.WorkflowContext
import com.atlassian.jira.workflow.WorkflowTransitionUtil;
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl;
import com.atlassian.jira.util.JiraUtils;

def issueMgr = ComponentManager.getInstance().getIssueManager()
ComponentManager componentManager=ComponentManager.getInstance()
def issueFactory = ComponentManager.getInstance().getIssueFactory()
def projectMgr = ComponentManager.getInstance().getProjectManager()
CustomFieldManager customFieldManager = componentManager.getCustomFieldManager()
User currentUserObj = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();

def cf = customFieldManager.getCustomFieldObjectByName('Link Field Name');
return "<a href='" + issue.getCustomFieldValue(cf) + "'>Nice Link</a>";

  • NOTE: You can avoid a lot of lines of my code, it’s only an example script with the typical imports and initializers…  
  • In Preview Issue key put the key of the issue you try to see the result of the field! Very easy!
  • Click “Update”
  • That’s all!
Posted by:.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s