Hi All,
Thanks for any help you can give.
I am creating several sub-tasks using JMWE post-functions and in the same instance trying to set the assignee of those sub tasks. I am trying to set them to the value of a custom field called Brand Manager which is set previously by the user.
I fear that I am not getting the syntax of the nunjucks expression correct - I have tried:
{{issue.fields.BrandManager.name}}
{{issue.fields.BrandManager.value}}
{{issue.fields.BrandManager}}
{{issue.fields.Brand_Manager.name}}
{{issue.fields.Brand_Manager.value}}
{{issue.fields.Brand_Manager}}
{{issue.fields.BrandManager}}
{{issue.fields.Brand_Manager}}
See the image below and the attempt to assign the Assignee.
We sadly do not have Scriptrunner at our disposal.
So for anyone interested - I found my solution the correct code was:
{{issue.fields.customfield_10901.key}}
The custom field variable and number I found by testing the nunjuck template on an issue with {{ issue.fields | dump(2) }} which gave me a full list of all fields and their content - then it was simply a case of searching for what I knew was the field value
BTW All of this is done in the JMWE - Post-function - create sub-task screen - then simply in the Assignee field using the above code.
Only possible recently because of the new straight foward nunjuck template test capabilities in the above screen when entering the code - huge help!
Hi Max,
actually, you should not use the "key" field but the "name" field (the username). In most cases, they are identical, but after you rename a user, they will diverge.
Also, when the field name contains a space, you can use this alternate form: issue.fields["Brand Manager"]
So the correct expression would be:
{{issue.fields["Brand Manager"].name}}
Finally, because of the asynchronous nature of Cloud post-functions, you might need to add a small delay (using the "Delayed execution" setting of the post-function) if the Brand Manager field is set during the same transition as the Create Issue post-function is run.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@David FischerAbsolutely beautiful David - that works fantastically. Thank you.
Is there, to your knowledge, a complete overview of syntax somewhere available or is the only way to find such correct codes to 'know' or to scour boards such as this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @maxandersen,
we have a lot of documentation about that:
However, it might not be sufficient, or not well organized, or not clear enough. Would you have any recommendation for us to make it better? Either the documentation itself, or access to documentation from the add-on's user interface.
Any suggestion (or criticism) is more than welcome!
Thanks,
David
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.