I am attempting to set the component of the subtask to that of its parent using JMWE in the workflow create transition for the subtask.
In the Nunjucks tester I use:
{{ parentIssue.fields.components | first | field("description") }}
And this does return the correct component (in the tester I specify the issue, and it fills in the parent automatically).
However, when running this code in the workflow post function for issue creation it does not set the component and gives this in the logs. Not an error, just INFO.
value:"{{ parentIssue.fields.components | first | field(\"description\") }}"
ignoreEmptyValue:false
conditionalExecution:false
sendNotifications:false
createMissingValues:false
valueIsJSON:false
_needsRefresh:true
appendValues:false_modified:"2021-03-23T12:09:34.558Z"
copyOnlyIfNotSet:false
fieldId:"components"
runAsType:"addonUser"
What am I doing wrong?
Hi Steven,
do you explicitly want to set the components field of the sub-task to the first component of the parent issue? If what you really want is to copy the Components field from parent to sub-task, you can simply use the Copy field value from parent post-function.
If you only want the first component, then the value should be:
{{ parentIssue.fields.components | first | field("name") }}
Hi David,
Thanks for your answer. While it is possible to set multiple components, in this project we want to indeed copy the first value. A quick test does appear that your code above works for me. Whats the different between name and description here?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Steven,
the "name" field is the component name, while the "description" field is the component description, as defined in Jira:
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.