I have a plugin, listing to event from post function, which perform 3rd party operation.
There is chances that 3rd party operation fails and gives 403, how can I restrict transition in such case
You do not.
Post-functions are actions Jira takes *after* a transition has occurred. They are done because the transition has been requested.
It's too late to "restrict a transition" when you get to post-functions - the transition is complete by the time you get to them.
If you need to do stuff that might fail in a post-function, then the usual thing to do is catch the failure in the post-function and have it handle the failure gracefully. The most simple thing to do is write something into the issue - a blunt "I tried to update system X, but something went wrong" comment or a "out of sync" flag field are the most common things I've seen, usually coupled with reporting or automation that finds them and retries it or tells an admin of the failure.
ok, Can we do it via validator?
For our business requirement this is common operation, and it can be out of sync.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, you can. Part of my instincts lean against it because a validator is a very simple function - it's just a "yes go ahead" or "no you can't do this because ..." thing, and actually making change in a validator is a really bad idea inside Jira - you'll have changed something you may not have meant to. You have to think through the impact on data, indexing and how to tell a user that they've done something despite not having to manage to do it.
But going to another system, asking it to make a change is not an issue. If the remote act is atomic and repeatable, then doing this in a validator is fine. (By atomic, I mean that if the request fails, no data is changed in the remote system, other than maybe logging that the action was attempted and failed. By repeatable, I mean that the user can try it again in Jira and the remote system will retry)
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.