In JIRA cloud using ScriptRunner I'm trying to get the parent summary so I can do a little string manipulation to add my own prefix to the sub-task summery generated via a ScriptRunner postfunction.
Anyone know how to get the parent field values and update the subtask using Scriptrunner?
I gather at the sub task creation "issue" realy means the parent? So I figured I could just trace the property value like this in the Additional code block.
import org.apache.log4j.Logger
logger.info("Parent task summary? " + issue.fields.summary); //doesn't work
logger.info("Subtask summary? " + subtask.fields.summary); //doesn't work either
Just trying to log it kills the function to generate the sub.
Hi Dan,
Thank you for your question.
I can confirm that your code shown above will not work as you cannot define the log4j import statement as this is not valid in *ScriptRunner for Jira Cloud* as the logging comes bundled so you can just write your logging statements without defining the log4j import statement.
I can also confirm that you are correct that in the *Create Subtask post function* provided by ScriptRuner for Jira Cloud that the issue object contains all of the fields from the parent issue which triggered the post function and that the subtask object contains all the fields which are being set on the subtask that is being created.
Finally, I can confirm that in the code snippet located here that the second example shows how to set the subtasks summary to be the summary from the parent issue with some extra appended and this may be a useful reference to help you to achieve your requirement.
I hope this information helps.
Regards,
Kristian
Check out my question on traversing the parent/child chain here:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.