Set Field Value From Linked Issue Function doesn't work when try to copy fix version or component fields from epic to story in create transition

I have story workflow where I have this kind of post functions in create transition:

The following will be processed after the transition occurs

  • Creates the issue originally.
  • Re-index an issue to keep indexes in sync with the database.
  • The value of field Fix Version/s will be set from the issue linked to the current issue by the has Epic link type (replacing existing values).
  • The value of field Account will be set from the issue linked to the current issue by the has Epic link type (replacing existing values).
  • The value of field Component/s will be set from the issue linked to the current issue by the has Epic link type (replacing existing values).
  • Fire a Issue Created event that can be processed by the listeners.

But only that tempo account field is copied from epic to story.

What I do wrongly with those fix version and component fields?

5 answers

Bit more debugging info. It seems that it can copy only custom fields. I add one more postfunction to copy PSI release custom field and that works fine. So it can copy my own custom fields like account and PSI release, but can't inherit system fields like component or fix version. Is that a bug or feature?

Actually, what I believe is happening is that no field gets copied, but you are getting the default value for your custom fields.

The reason is that when the Create transition is executed for the User Story, the link with the Epic is not yet created (it gets created after the User Story is fully created, because Links cannot be created before the User Story gets a final issue ID). Therefore, the post-functions find no Epic for the User Story.

This problem has been reported before on our issue tracker. 

No, there is not any default values for account or PSI release fields. Set Field Value From Linked Issue Function inherits those values. I tried that many times, and it really does that. And I tried that function also in other transitions (when that story already exists) and same happening.

So if you remove the post-functions for these custom fields from the Create transition, these fields are not correctly set? Strange. There is no difference between custom field and standard fields, as far as these post-functions are concerned...

After investigation, here is what is happening:

  • if you modify a system field in a post-function during the create transition before the "Create the issue" function, it works, but you cannot access values from linked issues
  • if you modify a system field in a post-function during the create transition after the "Create the issue" function, you cannot access values from linked issues, but the changes are never written to the database

Apparently, the same limitation doesn't exist for custom fields.

See https://innovalog.atlassian.net/browse/JMWE-258

 

My workaround solution for this:

 

In Epic workflow I have update stories transitions in every status. In that transition I run these posthooks:

  • The value of field Fix Version/s will be copied to the issues linked to the current issue by the is Epic of link type (replacing existing values).
  • The value of field Component/s will be copied to the issues linked to the current issue by the is Epic of link type (replacing existing values).
  • The value of field Account will be copied to the issues linked to the current issue by the is Epic of link type (replacing existing values).

 

In Story workflows create phase I have this posthook (after creates the issue oroginally posthook)

  • Transition Update stories will be triggered on all issues linked to the current issue through the has Epic link type.

 

Now story gets fix version, component and account fields from epic when it is created.

 

I'm not sure is that so pretty, but it works.

Edit — workaround JIRA.png

Workaround:

  1. Create transition from open to status open
  2. Get ID of this transition
  3. Edit transition Create
  4. Add post function: Transition (Transition 241 will be triggered on the issue)
  5. Edit transition hidden
  6. Add post function: Set Field Value from Linked Issue
  7. Add condition Hide transition from user

 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

78 views 0 5
Read article

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