Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

is it possible to block a transition in a post function?

Jon Hill
Contributor
January 17, 2019

I've written an Insight Post Function that, when an exception is encountered, updates a custom field with the error information and returns false.  The custom field is so that the user is aware of the problem.  I had it return false on the (bad) assumption that this would block the transition from continuing.

I just modified the code to throw a new exception instead of returning false, but that doesn't block the transition either.

Is there any way for a post function to prevent a transition from reaching its target status?  For example, is there a jira field associated with the transition that I can set to false?

1 answer

1 accepted

1 vote
Answer accepted
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 17, 2019

No.  A post-function is too late to block a transition, the only way to halt it in a post-function is to crash out, which can leave the data broken.

If you need to do things in a post-function that might fail, then do them, catch the error and let the transition complete, but put something on the issue to say "this failed - remote data is now wrong" (and if you've got an automation/scripting add-on, code something to either move the issue back, or repeat the remote update repeatedly until it works, maybe)

Suggest an answer

Log in or Sign up to answer