It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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. 

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

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.

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.

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'


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
Community showcase
Published in Marketplace Apps & Integrations

Expose your beautifully crafted Dashboard through the Jira Service Desk Customer Portal

  A picture is worth a thousand words, especially when you're trying to find relationships and understand your data. Here, Dashboards play a vital role in gaining insights from a variety of dat...

296 views 5 4
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you