I am trying to set Fix Version and Custom Field "Team Codes" when a sub-task is created. I have an Issue of Type PTR and I go to More -> Create sub-task. The PTR has Team Codes and Fix Version fields defined. As a test, I am using the the example script from Script Runner with the single change of modifying List copyCustomFields = ["Team Codes"]. I threw some log.error("blah") to see where it was existing and it's inside this if-statement:
if
(!parentIssueId || underlyingIssue) {
// this is not a subtask, or issue already exists, so don't set default values
return
}
I found this post:
Which lead me to this post:
https://library.adaptavist.com/entity/copy-field-value-from-parent-issue-to-sub-task-upon-creation.
This worked for me. I needed to copy a custom field as well as system field, Fix Version/s.
NOTE: ScriptRunner has a predefined Post-Function script called "Copy field values [ScriptRunner]" -- I couldn't get this to work properly; the log says that it runs without error but after the subtask creation, the field is empty/null, which is why I had to go the custom script route.
NOTE 2: There is also a free plugin that only copies custom fields not system fields, called Copy to Subtask Plugin. I also could not get this plug in to work for Custom Fields. Creates a menu item Create Subtask - JCTS.
NOTE 3: Finally, JMWE (Copy field value from parent issue (JMWE plug-in)). Also could not get it work for custom or system Fields.
Hi @Dan Long,
I think the best way to do this is by a postfunction on create in sub-task workflow.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess I'm not sure what you mean? Can you give me more detailed steps? I made a copy current workflow then assigned that to the sub-task, but the post-functions are the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.