I am trying to use Post Function in my workflow to to automatically create a subtask when an issue gets created. However, I'd like to set different assignees for both Parent task and Subtask, It appears that Post Function is forcing the assignee of the subtask to mimic that of the parent task.
For a variety of reasons I am not using Component in my Issue Creation screen but rather use a Custom Field that mimics Component.
Here is what the sequence of Post Function and any custom script looks like. Below is the exact copy of what I see in my workflow Post Function.
- The field Component/s will take the value from Custom Field. Source and destination issue are the same.
- Assign the issue to the lead developer.
- Creates the issue originally.
- The contents of the field Component/s will be purged.
- The contents of the field Assignee will be purged.
- Fire a Issue Created event that can be processed by the listeners.
- Script workflow function : Create a sub-task.
Subtask will be created with issue type: Sub-task
Step 7 uses the following code:
issue.summary = (issue.summary)
issue.assigneeId = 'username@email.com'
It is worth noting that Step 7 on its own executes fine and assigns the subtask to the proper user. It is when I try to assign the parent task, that subtask will inherit assignee from the parent task.
Any suggestion is welcome and appreciated!