how can I give user a message in a postfunction ?

I want to show a auimeaage to the user after a postfunction.How can I do that?

2 answers

1 accepted

2 votes

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

but I need do somthing when click “close” or“reopen” in a postfunction。 And then
return a message to the user according the result of the doing things.

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.

Listen to what Nic is saying. Post functions can't provide feedback. The transition has already been done, there are no further feedback opportunities. Only validators can give feedback prior to the transition.

how to do that in a Validator?

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.

I'm looking this:
https://developer.atlassian.com/display/JIRADEV/Creating+Workflow+Extensions#CreatingWorkflowExtensions-Part3.Createavalidator

I just do something during the transition .It dosen't compact the result of the transition .
And then I need give a message to the user to show the result of this thing which is done during the
transition

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.

It is said that there is no way to implement whta I want?
Is there any way to show a dialog in postfunction?

OK,I can't do what I want but thanks

I think we've answered that several times already.

Some of the answers include the way to get close - write the information to the issue, then the user will see it.

I have implemented the close way.however, I don not satisfied with it.

I have a judgement in the postfunction.if it is false then I pop this message.
Can any method to implement it?

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

799 views 3 11
Read article

Atlassian User Groups

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!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you