Hi I am trying to figure out the fallowing scenario using SIL Condition post function on Jira if any of the linked issue statuses is Rejected auto transition the current issue or neglect the transition
string value = linkedIssues(key);
for (string link in linkissues) {
if(%link%.status != "Rejected") {
return false;
} else {
autotransition("Reject",key);
boolean exists = true;
}
}
Please sujjest the best way to check this
Hi,
you confuse 2 things. Post function is something different and condition is something different. If you try to combine it... maybe do sth like this:
string issueKey=key; string [] values = linkedIssues(key); boolean isAnyLinkRejected=false; for (string linkedIssue in values) { if(%linkedIssue%.status == "Rejected") { isAnyLinkRejected=true; } } if(isAnyLinkRejected){ autotransition("Reject",key); }
It should be ok now. If not let me know.
Work also on your programming skills because you made several "big" mistakes in your code
Michał, if I can add something: I would go for escaping the for loop as soon as you will hit the link to rejeceted issue. It would be slightly more efficient:
string issueKey=key; string linkedIssueKey; string[] values = linkedIssues(issuekey); boolean isAnyLinkRejected=false; number numberOfLinks = size(values); for (number i=0; (i<numberOfLinks && isAnyLinkRejected == false); ++i) { linkedIssue = values[i]; if(%linkedIssue%.status == "Rejected") { isAnyLinkRejected=true; } } if(isAnyLinkRejected){ autotransition("Reject",issuekey); }
Not much difference if there are few links on the issue, but noticeable difference if there are tens of them.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I agree it will be more efficient especially if you will have many links.
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.