How can terminate update issue event, with custom error from Java code.
I need to be able, to terminate it if new value for some field is not valid. And it be just wonderful if I can show Error message after that.
Thanks for help!
This is exactly what workflow validators are for - they'll throw a "pass" or "fail, with error message".
But those only happen in the workflow. Other events (such as comment, edit, add workflow etc) do NOT have any validators you can hook into. You can make listeners that catch them, but it's too late at that point and there's no feedback to the users.
Yes, you can, as long as you have the "links" field on screen for them (that is only available on later versions of Jira). When your validator runs, it has access to the current issue data (which is empty for new issues) and the data the user has entered. So you can indeed iterate through all the links the users have added, have a look at their type and return a "fail" if you don't find any called "implements"
Can you please be more specific.
I've tried to find links that user added with ComponentAccessor.getIssueLinkManager().getOutwardLinks(issueId) inside my validate() method.
This only gives me NullPointerExecption, I guess it's because the Issue is not yet created and ComponentAccessor dont know about this Issue.
Can you tell how exactly I can obtain 'Linked Issues' field values in 'Create Issue' dialog window?
List of IssueLink's ?
List<IssueLink> links = (List<IssueLink>) issue.getExternalFieldValue("issuelinks");
gives exception :
com.atlassian.jira.issue.fields.IssueLinksSystemField$IssueLinkingValue$Builder$1 cannot be cast to java.util.List
how can I iterate through such object?
Sorry, no, I'm going in the wrong direction there. Although I've said use the links field, it's not really a field, it's a place to capture links. You should be able to iterate through the links on the incoming issue. However, I've only ever done this with something linke issueLinkManager.getLinkCollection(issue, user) on existing issues, so I'm not entirely sure itl work on create.
Atlassian Summit is an excellent opportunity for in-person support, training, and networking.Learn more
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!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG