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

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

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

This widget could not be displayed.

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.

This widget could not be displayed.

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

This widget could not be displayed.

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. 

This widget could not be displayed.

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.


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

48 views 2 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you