No. Post-functions are NOT for "judgement", they are for doing things when you have a definite set of validated data.
You should establish if your data CAN be processed in a validator and put the message in there. Or, you need to write some sort of message back into the issue so that when the user lands on the issue view screen, they get told the result
As Bob says, you don't do this in a post-function.
If you click "close", you do one thing to the issue. If you click "reopen", you are doing something else. They go through different routes in the workflow, and that means you can put different post-functions on them to do different things. The decision about where a transition lands is made well before you reach a post function, that's too late for user interaction.
If your post-functions need to capture data and report back to the user, that's fine - they should write their information on to the issue so that results are logged.
A validator is a block of code that returns either "True" (meaning the transition is clear to continue) or "False" (user is returned to the transition screen or even the issue if there's no screen, without any changes being made).
With a "false" response, you add responses to the user by throwing InvalidInputException. If you want these to appear differently from the way Jira currently shows them, you'll need to amend the core code to provide alternate feedback.
Also, bear in mind the blunt nature of a validator. It's a yes/no response which allows or blocks the transition. You should NEVER change any data, inside Jira or in other systems in a validator, because you simply do not know if the transition is going to succeed.
I want to give a message to user like that pop auimessage that when I create an issue.
A validator is the wrong place to "do something during a transition". Your original question was the right place - you do things in post-functions. Validators are for checking input.
As we've already told you though, if you want feedback from a post-function, you need to write it on to the issue so that it will be displayed on the view screen. If you want to change the way that works, you will need to start hacking the core of Jira.
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
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot