I am using this plugin to transition linked issues when the link type is fixed by, but I only want the post-function to execute when the linked issue is in a certain project. I want to add this in the condition section. How can I achieve this?
You can try the following (untest) Groovy condition script:
linkedIssue.get("project").getKey() == "<project key>"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
David,
Can this be extended to be project or project category specific?
For example, something like this:
If project in A, or B, or C
linkedIssue.get(
"project"
).getKey() ==
"<project key>"
linkedIssue.get(
"project"
).getKey() ==
"<project key>"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For multiple projects, you can do something like:
linkedIssue.get("project").getKey() == "A" || linkedIssue.get("project").getKey() == "B" || linkedIssue.get("project").getKey() == "C"
And for a project category:
linkedIssue.get("project").getProjectCategoryObject().getName() == "<project category name>"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
David,
I modified the code a little. I want to ensure the current issue is in project category "Learn" and the linked issue is in project CS.
I was able to get the first half of the conditional statement working, but have not been able to get the linked issue to transition.
I think I am looking for something like this
issue.get("project").getProjectCategoryObject().getName() == "Learn" && linkedIssue.get("project").getKey() == "CS"
Each condition works on it's own, but when I try to concatenate the two statements, the linked issue does not transition
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And yet the condition seems to be correct. Are you sure you can reach the two conditions at the same time?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I modified the post function to test each part of the expression
When I set the expression to just this:
issue.get("project").getProjectCategoryObject().getName() == "Learn Tech"
the linked issue is not transitioning as expected.
When I set the expression to just this:
linkedIssue.get("project").getKey() == "CS"
The linked issue transitions as expected.
So there is something in the first expression that is not right. Please note that I have updated my examples to show that my project category has a space in the name.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any error in the logs? (atlassian-jira.log)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nope, nothing in the logs at all
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see this when configuring the post function:
"log: a Logger instance that writes into atlassian-jira.log (useful for debugging)"
How do I add log to the expression?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can do something like:
log.error("project category: "+issue.get("project").getProjectCategoryObject().getName()); return issue.get("project").getProjectCategoryObject().getName() == "Learn Tech" && linkedIssue.get("project").getKey() == "CS"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, I added the follow statements:
log.error("project category: "+issue.get("project").getProjectCategoryObject().getName()); log.error("linked project:"+linkedIssue.get("project").getKey()); return issue.get("project").getProjectCategoryObject().getName() == "Learn" && linkedIssue.get("project").getKey() == "CS"
The values being returned to the log are correct:
project category: Learn Tech linked project:CS
The linked issue is still not being transitioned Ugh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You left "Learn" instead of "Learn Tech" in your test
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry just a typo in the response above. The code in JIRA states Learn Tech
log.error("project category: "+issue.get("project").getProjectCategoryObject().getName()); log.error("linked project:"+linkedIssue.get("project").getKey()); return issue.get("project").getProjectCategoryObject().getName() == "Learn Tech" && linkedIssue.get("project").getKey() == "CS"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Holy Cr@p I found the issue.
My project category had a trailing space in the name!!
Once I edited the project category to remove the training space, the linked issue transitioned as expected.
Thank you so much for all your help and patience with this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
On the plus side, the post function did exactly what it was supposed to do. Since the project category did not match the groovy expression, the linked issue was not transitioned.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm glad you found your problem! I'm sorry, I should have thought to ask.
If you are satisfied with our product and our support, would you mind providing a quick review for us in the marketplace? [This link| https://marketplace.atlassian.com/plugins/com.innovalog.jmwe.jira-misc-workflow-extensions/cloud/reviews] will take you directly to the reviews page.
Much appreciated!
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you running JMWE on JIRA Server or JIRA Coud?
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.