In Post Function when I try to create a subtask on Issue Creation transition, the subtask inherits assignee from Parent

Moon April 10, 2015

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. 

  1. The field Component/s will take the value from Custom Field. Source and destination issue are the same.
  2. Assign the issue to the lead developer.
  3. Creates the issue originally.
  4. The contents of the field Component/s will be purged.
  5. The contents of the field Assignee will be purged.
  6. Fire a Issue Created event that can be processed by the listeners.
  7. 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!

4 answers

0 votes
Moon May 1, 2015

Hi @Jamie Echlin [Adaptavist]

But in the documentation here https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-Clonesanissueandlinks for cloning it is mentioned that and I quote:

"If you want to override some of the field values rather than have them inherited from the source issue you can specify that in the Additional Code field"

Is it not possible to override the subtask assignee in Additional Code field?

I appreciate your response.

Thanks

0 votes
Moon April 13, 2015

I am using a Custom Field to mimic Component but with a different name. Line 1 essentially copies the value from the custom field into the component. Component has a Lead associated with it. So when ticket gets assigned through Line 2, it will get assigned to the proper owner. 

I am having an issue getting the custom script post function executing. My systems set up tells me that ScriptRunner is enabled but for the life of me I cannot get the custom post function to do anything. 

0 votes
Moon April 13, 2015

Hi @Jamie Echlin [Adaptavist], any help/suggestions will be appreciated! cheers!

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 13, 2015

You can't do that in a listener, you need to do a proper edit if you want to change values after the transaction has already been committed. 

You should just a standard script post-function, place it towards the top of the list of post functions, and that should work. Although I don't know what line 1 is supposed to do.

Suggest an answer

Log in or Sign up to answer