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";
}
else
{
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)
Cheers,
Ganga
image2016-5-25 15:19:24.png
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"); return; }
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have no idea how Remedy updates that value and when, so I cannot help you unless you elaborate.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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"
Try first removing the "Hide Transition" condition and see if it then works.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
Cheers,
Ganga
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ganga Selvarajah
please move your post-function (3. Creates the issue originally.) on first place and check
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, sorry for the late response.
I tried, but no luck....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
Cheers,
Ganga
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.