Issue Linking

AKASHB July 23, 2013

createIssueLink (Long sourceIssueId, Long destinationIssueId, Long issueLinkTypeId, Long sequence, User remoteUser)


Cananybody help me out figuring what parameters do i need to pass in?

Suppose i have 2 issues with me say Mutable issue as "issue" and other as "opt"

so now what i need to pass?

2 answers

0 votes
Andrew Culver
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 23, 2013

To find the link type id, go to Administration > System > Issue Linking. Here you will see your Jira instance's link types. Each will have an "Edit" and "Delete" operation hyperlink. Mouse over these hyperlinks and you will see the link type id at the end of the URL.

For example https://yourserver/secure/admin/EditLinkType!default.jspa?id=10020

The id=10020 indicates the link type id is 10020.

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 23, 2013

You need to pass in:

  • The id of the first issue (mutable issue)
  • The id of the second issue (opt)
  • The id of the type of link you want to create
  • The number of the link you want to create (if an issue has 7 links already, you want to pass in "8" here)
  • The object representing the user who is creating the link
AKASHB July 23, 2013

I got the point for SourceIssue ID, Destination Issue ID, User. but id of the type of link is what i am stuck, so can you elaborate on it?

My code seems like this.












































AKASHB July 23, 2013

Sorry nic, code didint get attached. okay that value i got it from database.

Here is my code:


def public TransitionStatus(MutableIssue issue)

{


def cfopts = issue.getCustomFieldValue(customField_name)
def MutableIssue opt = issueManager.getIssueObject(cfopts)

log.warn("get OPT name: " + opt.key)


def currentUser = jiraAuthenticationContext.getUser();


Collection<ActionDescriptor> actions1 = issueWorkflowManager.getAvailableActions(issue);
log.warn("Action for Candidate Tickets are: " + actions1)
log.warn("Open Position :" + opt.dump())
log.warn("Open Position Class : " + opt.getClass())
log.warn("Current Status for open position" + opt.getStatusObject())

def jiraworkflow = workflowManager.getWorkflow((Issue)opt) as JiraWorkflow;

def transitions = jiraworkflow.getAllActions()

def status=jiraworkflow.getLinkedStatusObjects()


WorkflowTransitionUtil workflowTransitionUtil = ( WorkflowTransitionUtil ) JiraUtils.loadComponent( WorkflowTransitionUtilImpl.class ); //This will capture the Wokflow
workflowTransitionUtil.setIssue(issue); //This will set the Issue
workflowTransitionUtil.setAction(221);//This will set the Action Id to Make an Offer Transition
workflowTransitionUtil.progress(); //This will vallidate the progress
log.warn("I have set the Status Transition have performed from Second Round to Make an Offer!!")

WorkflowTransitionUtil workflowTransitionUtil1 = ( WorkflowTransitionUtil ) JiraUtils.loadComponent( WorkflowTransitionUtilImpl.class );
workflowTransitionUtil.setIssue(opt); //This will set the Issue
workflowTransitionUtil.setAction(11); //This will set the Action Id Candidate Joined Transition
workflowTransitionUtil.progress(); //This will vallidate the progress
log.warn("I have set the Status Transition have performed from Pending to Candidate Joined for OPen Position !!")

}

TransitionStatus(issue)

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 23, 2013

I can't see any code there, but I can try to explain the link type id.

If you, as an administrator, go into "issue linking" in the web interface, you'll see a list of link *types*. For example "related", "cloned", "dependent on" and so-on. You need to pass in the ID of the link type you wish to use.

Suggest an answer

Log in or Sign up to answer