Forums

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

Unable to set parent component to subtask using JMWE

Steven Rhodes
Contributor
March 23, 2021

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?

1 answer

1 accepted

0 votes
Answer accepted
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 23, 2021

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") }}
Steven Rhodes
Contributor
March 24, 2021

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?

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 24, 2021

Hi Steven,

the "name" field is the component name, while the "description" field is the component description, as defined in Jira:

image.png

Suggest an answer

Log in or Sign up to answer