It's not the same without you
Join the community to find out what other Atlassian users are discussing, debating and creating.
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?
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>"
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>"
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
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 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"
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
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"
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.
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
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.
Read moreAtlas Camp is our developer event which will take place in Barcelona, Spain from the 6th -7th of September . This is a great opportunity to meet other developers and get n...
Connect with like-minded Atlassian users at free events near you!
Find a groupConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.
Start an AUGYou're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.