How to pass values between two post-function scripts that belong to the same transition?

I am working on being able to create an issue and automatic link this issues to multiple issues with different link types on the post-function of the Create transition.

As a note, I cannot use the stander Linked Issues field because I need to be able to create different type of links.

My workaround is adding custom fields to the Create Screen where I specify the issues a want to link to and the linktype so that I can then access these fields in the Create post-functions.

However, I would like these custom fields not to be stored in the database because they are meaningless after the creation process has been completed.

So, my idea is to have a post-function to be execute before  the standard post-function "Creates the issue originally." This post function would store the values of the custom fields "somewhere" and then set these custom fields to null so that they will not be stored into the database.

Then another post-function would be executed after the standard post-function "Creates the issue originally". This post-function would fetch the custom fields values stored "somewhere" and use them to link the newly created issue to the other issues.

So, how can I pass values between these two post-functions?

 

 

6 answers

This widget could not be displayed.

You should probably only have one scripted post function that reads the custom field values, does the update then finally clears the values for these custom fields. Passing data between post-functions may be a pain.

What did you envision the create issue screen to look like with these fields? Perhaps if you could provide a screenshot I can add some code to get you started. 

This widget could not be displayed.

Are you suggesting to add this post function after the standard post-function "Creates the issue originally" ?

This widget could not be displayed.

Yes, it will need to be created before you can access it in the post-function. Happy to add some code to make it clearer once I know what data you'll be passing in the fields.

This widget could not be displayed.

I was hoping to being able to avoid having the issue created and then having to update it to clear the values. My idea was to pass the values from a post-function execute before the standard post-function "Creates the issue originally" to a post-function executed after the standard post-function "Creates the issue originally" so that when the issue is create the custom values have already been cleared.

This widget could not be displayed.

issue is not null before creating the issue. Before creating the issue "issue" reflects the value inputted in the Create Screen. I did add the following code before creating the issue

issue.summary = 'Hello'

and all of the issue created afterwards had the field summary set to 'hello'

 

This widget could not be displayed.

Your right, i'm sure it worked like that some time ago. It definitely needs to be stored first before you retrieve it again maybe that was it. You'll probably have to use the setters in the issue object to set the fields before its stored in the database.

I still don't think you would need two post-functions.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted 3 hours ago in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

14 views 0 4
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