Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

CreatingLink using Issue Link field (Inward/Outward Link)

Edited

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

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events