Quantcast
Viewing all articles
Browse latest Browse all 3

How to set the description of a JIRA Workflow Validator?

I'm working on a simple JIRA Server plugin that will prevent a transition from occurring if a certain custom field has not been set. I have created a new workflow validator with atlas-create-jira-plugin-module and tailored the validate function to fit my needs. Strangely, when I add this new validator to a transition via the workflow editor, it appears in the list of validations with the wrong description. It is showing the description from the default condition, "Only users with Resolve Issues" permission can execute this transition".

I've been following along with this tutorial: https://developer.atlassian.com/server/jira/platform/creating-workflow-extensions/ I also came across this similar tutorial: https://www.j-tricks.com/tutorials/workflow-validator

In my atlassian-plugin.xml I made sure to define a "view" velocity resource:

<workflow-validator key="custom-field-is-set-validator" name="Custom Field Is Set Validator" i18n-name-key="custom-field-is-set-validator.name" class="com.ngc.jira.plugins.workflow.CustomFieldIsSetValidatorFactory"> 
    <description key="custom-field-is-set-validator.description">Validation to require that a custom field be given a value.</description>  
    <validator-class>com.ngc.jira.plugins.workflow.CustomFieldIsSetValidator</validator-class>  
    <resource type="velocity" name="view" location="templates/validators/custom-field-is-set-validator.vm"/>  
    <resource type="velocity" name="input-parameters" location="templates/validators/custom-field-is-set-validator-input.vm"/>  
    <resource type="velocity" name="edit-parameters" location="templates/validators/custom-field-is-set-validator-input.vm"/> 
  </workflow-validator>

And the contents of custom-field-is-set-validator.vm are as follows:

Only if the custom field <strong>$field</strong> has be set.

As a sanity check, I created a workflow condition and applied my velocity (vm) resource as the view template for it. It shows up correctly within this context!

However, when I try to use the same velocity resource for my workflow validator, the admin page still displays the validator as "Only users with Resolve Issues permission can execute this transition" instead of using my description.

What am I missing? Thanks!

Screenshot showing the built-in condition

Screenshot showing my validator that is wrongly appearing as the same condition


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>