Stage 3: Implement interaction with user
Workflow Condition actions
In previous steps, you wrote a workflow condition which presents simple error message to a user but doesn't allow for any user interaction. ResultMessage can also contain actions which allow for such interaction. The starting point for building any kind of action is the
com.atlassian.crucible.workflow.ResultAction interface. Crucible allows for two types of actions:
- URL action
The URL action represents a simple HTML link. It can be constructed with the
buildUrlAction method. For the purpose of this tutorial, let's include the link to a Users page in a failed condition message.
- AMD module which exports an object with the onClick function
reviewId→ returns the review id
hideDialog→ hides transition dialog
resolveMe→ resolves current condition on the front-end side, which results in removing it from the dialog. Note: This action will affect only the front-end side. If the problem which triggered the workflow condition is not fixed, the transition will fail again
showError→ shows error banner in the current dialog, accepts error message
hideError→ hides error banner
In the next step, we'll extend remind-handler to resolve the condition when AJAX call succeeds and show the error banner in case of an error. To do that, we'll use the context object as a handler.
With such handler, if the request succeeds, Crucible will remove given message from the list. In this particular case there was only one error message so the user is allowed to proceed.
workflowConditionContext.showError(); shows the following error banner: