Forums

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

editing parent issue fields in a workflow transition of sub-tasks

Pujan Ziaie
Contributor
January 30, 2018

Hello,

I'm trying to update some custom fields of a parent issue in a transition of a sub-task workflow. For this, I need to get the parent issue Id from the issue object (of the sub-task).

Unfortunately I couldn't find the REST reference for this. Where is a comprehensive documentation of ScriptRunner Issue Object? Would you please point me to the right method?

Thank you in advance, pj

1 answer

1 accepted

0 votes
Answer accepted
Thomas Deiler
Community Champion
January 30, 2018

Dear @Pujan Ziaie,

Firing a GET/ http://128.0.0.1:8080/rest/api/2/issue/ISSUE-6 (this is a sub-task) will also return the information about its parent (JSON response):

{
"expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations",
"id": "10500",
"self": "http://128.0.01:8080/rest/api/2/issue/10500",
"key": "ISSUE-6",
"fields": {
"issuetype": {
.
.
.
},
"parent": {
"id": "10200",
"key": "ISSUE-4",
"self": "http://128.0.0.1:8080/rest/api/2/issue/10200",
"fields": {

In this case the parent was ISSUE-4.

Is that what you where looking for?

Pujan Ziaie
Contributor
January 30, 2018

Hi!

Thanks for the tip! Well I was more looking for something like issue.fields.parent.id or something, so that I won't have to call yet another web service. But if the field is non-existent in the issue object in the post-function, then I guess there is no other way.

Thomas Deiler
Community Champion
February 1, 2018

Dear @Pujan Ziaie,

was my answer fine enough to be accepted or do you need more information?

So long

Thomas

Pujan Ziaie
Contributor
February 1, 2018

Hi Thomas,

Sure it was correct. I was just waiting for a method I could possible call on the issue object to get parent Id to avoid calling a REST function. But now that no one has expressed anything, I guess the method doesn't exist.

Suggest an answer

Log in or Sign up to answer