We need to create multiple sub-task tickets, in same project, when a Bug ticket is created. Each sub-task will have a different summaries (part of it will be the summary of the Bug ticket), different descriptions, and different assignees from each other. I have the iterator set, but somehow the summary on the create for the sub-tasks is "null".
Hi @Ashvin
the syntax to access the summary attribute of the current iterator value is simply:
it.summary
Also, the iterator is incorrect for the summary and for the assignee. Use this instead:
[
{summary:"Bug investigation", assignee: "accountId:1234"},
{summary:"Requirements SRS", assignee: "accountId:5678"}
]
and then for the Summary field, use:
{{it.summary}} ({{issue.fields.summary}})
That all worked, Thank you, thank you for that quick solution/fix.
Just one more little thing: when setting the assignee field, the Bug issue type does not have the Assignee field on the Create screen to be set, so the value is unassigned. How to set the assignee for the sub-tasks to be whatever it is on the parent, even it is not set to any user, since this workflow is actually used in 43 diff projects.
Currently, I have : {{it.assignee}} ({{ issue.fields.assignee.accountId }})
however, that is not correct as the value is "unknown" for both accountId and id as well.
There are also a few "Warning" messages in the JMWE log file indicating that the post-function is still using usernames and must be updated to use accountIds instead, but this is exactly what I have written.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ashvin
the value for the Assignee field should be only an accountId, so:
{{it.assignee}}
As for your question, I didn't get what the problem is for the Bug issue type.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There really was no question related to Bug issue type. I was just providing a little more context/detail regarding the purpose of this post-function.
Again, thank you for the quick solution to my question/need.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So, seems the summary fields of the new sub-tasks are not actually picking up the value being set in the Iterator with the parent's summary field value as the code is set to set, only the ({{issue.fields.summary}}) the actual value of the parent summary field is being set for the sub-tasks.
Also, it seems that even though the iterator indicates (from what I have read/understand) that 2 new tickets should be created, there were 6 created now. I have a conditional that should stop any sub-tasks from being created in the project that I'm using for the testing:
{{ issue.fields.project.key == "ONHOLD" }} && {{issue.fields.issuetype.name == "Bug"}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you share your full post function configuration ? As for your conditional execution script, it’s incorrect: the "and" operator is actually and and it should be inside the curly braces:
{{ issue.fields.project.key == "ONHOLD" and issue.fields.issuetype.name == "Bug"}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ashvin ,
you have an extra double quote on the second line of your iterator. Please double-check.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You were correct. I removed that extra double quote and modified the condition to read only if the issue was type Bug should the post-function be executed.
However, there were still 6 sub-tasks created instead of just 2, based on the iterator. here is the modified iterator:
[ {summary: "Bug Investigation " + , description: "", assignee: "accountId:5e46f12d2a59dc0c8fe4c51d"},
{summary: "Requirements SRS "+ , description: "", assignee: "accountId:5e46f12d2a59dc0c8fe4c51d"}
]
and the condition:
{{issue.fields.issuetype.name == "Bug"}}
Second issue is that Summary of the sub-tasks tickets are including only the Summary from the "parent" Bug ticket and not what is part of the iterator. The value of the Summary fields should be set to what is in the previous screenshot, also pasted here: {{it.summary}} ({{issue.fields.summary}})
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Now there is a "+" after the summary value that shouldn't be there. As for 6 subtasks being created, I have no idea why. Can you post a screenshot of the whole post function configuration?
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.
Hi @Ashvin ,
you need to check the "Iterator returns JSON" option.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Made the change and now receiving a new error: Unexpected token s in JSON at position 3
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Right. The JSON syntax is incorrect, attribute names need to be between double-quotes. Sorry about that.
[
{"summary": "Bug Investigation ", "description": "", "assignee": "accountId:5e46f12d2a59dc0c8fe4c51d"},
{"summary": "Requirements SRS " , "description": "", "assignee": "accountId:5e46f12d2a59dc0c8fe4c51d"}
]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you once again for helping me understand and fix this post-function. It's working now as expected.
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.