MISC workflow post function - how to get the changed priority value during the issue creation

I am using following Groovy expression post function to get a priority value and set it to a custom field during a issue creation. 

if(issue.get("priority").getName() == "Minor" || issue.get("priority").getName() == "Trivial")

return "Low Priority";
return "TBD";

The above groovy expression post function is working for issue created manually, but it is not working if a issue created via Remedy.

How do I extend above groovy expression to check that, priority value has changed during a issue creation via Remedy. (Please see the attached)




image2016-5-25 15:19:24.png

3 answers

Hi @Ganga Selvarajah

please move your post-function (3. Creates the issue originally.) on first place and check

Thanks, sorry for the late response. 


I tried, but no luck....

Did you check your logs (atlassian-jira.log) for errors or warnings right after creating the issue from Remedy?

You can also add some logging to your script using the log object to find out what the priority field contains when the post-function runs:

log.error("Priority is: "+issue.get("priority").getName());

Also, make sure the priority field is not simply empty (null) at the beginning of your script:

if (issue.get("priority")==null) {
	log.error("Priority field is empty");

Hi David,

Thanks a lot your suggestion.

The priority field always has a value (default is = Major). Via remedy interface we're getting priority value. it is get updated correctly for a newly created issues, but set value Groovy expression post function is taking a default value (Major) instated changed value.

how do I get the changed value?


I have no idea how Remedy updates that value and when, so I cannot help you unless you elaborate.

a log information will it help you to see the issue?

here is the screenshot of the issue history tab. The values comes from Remedy (Region, Priority & Case Id)


image2016-5-26 10:58:44.png

during the issue creation the priority value changed from Major to Minor, but Groovy expression script is always getting original value. In this case, it is "Major"

Judging from the history, the priority is changed AFTER issue creation (hence the "original value"). This is why the post-function, which runs DURING issue creation, doesn't see the changed value.

So you need to investigate how this synchronization with Remedy works, and if you can modify the custom field during that sync.

Actually, priority field changed during a issue creation.

In JIRA default priority is set to Major, so that during the issue creation priority value has changed from Major to Minor.

if there any way to get a new value through the Groovy expression script?




Well, I can guarantee you, with absolute certainty, that the priority field is not changed during the Create transition. It is likely updated by an event listener that reacts to the Issue Created event, but it takes place immediately after issue creation so you don't notice it.

The reason why I am positive is that otherwise you wouldn't see an entry in the issue history. And the other reason why I'm sure is because I see no post-function that would handle that synchronization with Remedy.

So, since the Set Field Value post-function runs during the Create transition, it cannot see the updated value.

However, what you can do is create an "auto-transition", from the first Status of your workflow onto itself, hidden by the Hide Transition condition, and on that transition you place the set field value post-function. Finally, you trigger that transition automatically at the end of the Create transition using the Transition Issue post-function.

Hi David,

firstly: Thanks for your time to help me on this issue.  I followed your steps, but auto transition is not executed. Am I doing some thing wrong here? please see the attached...

image2016-5-26 13:36:47.png




I can't see the bottom of your screenshot, so I can't see how you trigger the "Auto transition" from the Create transition. Note by the way that you don't need to call it "Auto Transition" wink

Try first removing the "Hide Transition" condition and see if it then works.

didn't work after removed the "Hide Transition" condition. I can see "Auto Transition" button is visible after removed the Hide Transition condition.

Please see the create and auto transition screenshots.

image2016-5-27 9:13:47.png

image2016-5-27 9:16:33.png

Are you certain of the transition ID for your "Auto Transition" transition? Can you try with the transition name instead?

Also, on the Create transition, try moving the Transition Issue post-function to the end of the list.

It works perfectly after moved Transition Issue post function to the end of the list.

Thanks a lot for your time to resolve this issue. I believe most of users definitely get benefits from your solution.





It works perfectly after move Transaction Issue post function to the end of the list.

Thanks a lot for your time for me to resolve this issue. I believe lots other users definitely get benefits from your answer. 




Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,294 views 5 10
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