You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hi Team,
I have IssueType called 'Initiative' & 'EPIC', whenever I create an EPIC I will link Initiative using Issue link picker field type 'Initiative Link', as part of this process I want to link the same issue whatever I selected as 'Initiative Link' to be linked to my EPIC as 'child of' & same should be viewed in the issue link section of 'Initiative' with 'parent of' relation, in attempt to do this, I have created behavior for the field 'Initiative Link', so whenever this value is selected during create/Edit, it should update the issue-links with the same issue selected.
I have written the code like this, but I get an error when I run in console & same is not working in behavior too, not having any compilation error though but get some run time error
---------- 'org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'ABC-1617' with class 'com.atlassian.jira.issue.IssueImpl' to class 'java.lang.Long'
at Script784$_run_closure1.doCall(Script784.groovy:16)
at Script784.run(Script784.groovy:14)' ---------------
My code is
---------------------------------------------------------------------
---------------------------------------------------------------------
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def jiraAuthContext = ComponentAccessor.getJiraAuthenticationContext()
def long tpIssueLinkType = 12030
def MutableIssue cfIssue
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
CustomField customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_14771")
Issue issue = issueManager.getIssueByCurrentKey("ABC-1703")
issue.getCustomFieldValue(customField).each
{ iscr -> cfIssue = issueManager.getIssueObject((Long)iscr) issueLinkManager.createIssueLink(cfIssue.getId(), issue.getId(), tpIssueLinkType, 1L, currentUser) }
----------------------------------------------------------------------
----------------------------------------------------------------------
Any help would be appreciated!
thanks
AJ