Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira Issue parameter access

DILEEP KUMAR June 19, 2018

Hi,

I have an requirement to access the existing JIRA issue and it's different parameter like-Type, Status etc using groovy script in post-function. 

Any suggestion, how can i achieve this ?

Regards,

Dileep 

1 answer

0 votes
Alexey Matveev
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.
June 19, 2018

Hello,

Your code would be like this:

import com.atlassian.jira.component.ComponentAccessor

def issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("issue key")

issue.getSummary()

issue.getStatus()

issue.getIssueType()
DILEEP KUMAR June 19, 2018

Thanks @Alexey Matveev for your reponse !! I will check the above script.

Now, I have a sub-task in above issue. How can i access sub-task of given issue, using groovy script ?

Could you please suggest ?

 

Regards,

Dileep.

Alexey Matveev
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.
June 19, 2018
import com.atlassian.jira.component.ComponentAccessor

def issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("issue key")
issue.getSummary()
issue.getStatus()
issue.getIssueType()
issue.getSubTaskObjects().each{subtask ->
subtask.getSummary()
}
DILEEP KUMAR June 20, 2018

Thanks @Alexey Matveev for response !!

 Now, i have the below requirement :- 

If Status of Child Issue1 changes from To Do --> WIP then the type: Sub-Task should replace all other child issue type, if its different.IssueStatus.PNG

Screen-Capture is attached.

 

Could you please suggest ?

 

Regards,

Dileep.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events