i am using jira software cloud instance and also having scriptrunner installed. i want to get parent issue key from its subtask on one of the transition using scriptrunner.or can i copy one custom field value from subtask to its parent issue type field?
Hello in a transition you can get the key (or any other field from the parent of a subtask)
public String getParentKey(issue){ def parent = issue['parent'] as Map parent.key}
Such a function returns the parent key
If what you need is to copy info from the subtask to the parent you have to obtain the values of the fields, build a map and perform an update of the parent
public static void updateIssue(issueKey, updateMap){ def result = put("/rest/api/2/issue/${issueKey}") .queryString("overrideScreenSecurity", Boolean.TRUE) .header("Content-Type", "application/json") .body([fields:updateMap]) .asString()if(result.status != 204) throw new Exception(result.body)}
Regards
Hi @chinmay konkar
We have an example here where it shows how to sum up values from fields on a subtask and store them in the parent. You can use this example as a guide/reference to help create the script that you require.
I hope this helps.
Thank you
Kind Regards
Kate
Thanks a lottt ! @Kate Kabir It worked for me.
@Juan Manuel Ibarra thank you so much for your reply !
It looks like you're new here. Sign in or register to get started.