I set the validator "If a value for field Linked Issues is not provided during the transition, show the following error: This field is required. " in the Create Issue transition in one of my workflows, and if I do not put anything on the Linked Issues fields when creating the issue, instead of informing the error message, JIRA shows me the validation error "Error creating issue: An unknown exception occured executing Validator com.innovalog.jmwe.plugins.validators.FieldRequiredValidator@7f9933ca: root cause: java.lang.NullPointerException" .
Any clue?
You will need ActionContext to get the web request. It's fragile though. See eg https://answers.atlassian.com/questions/139592/check-for-duplicates-link-in-groovy-transition-validation-script
Yes, that's because the field is not really a field - it's an area for the user to enter text that will be converted to issue links, not actual data to be checked. I'm afraid the JMWE isn't quite clever enough to validate this "field" - you'll need to find/write something that looks directly at the actual issue links to do this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Nic,
I just need to grant that there is at least one issue linked. As I do not know too much about scripting, could you, please, write down a single line script that checks if there is any entry linked (id doesn't matter wich one). I guess that some simple check if the number of linked issues is >= 1 will satisfy my needs. Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, it depends on what plugin you're using for scripting. But I've never done it myself, I wrote a field that counted links years ago, and then used a "number > x" validator on it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I use the JIRA Misc Workflow Extensions. It allows me to write very simple scripts to use in validations. As an example, I have the single-line-script "issue.issueTypeObject.name == 'Epic'" in one of my workflows that allows me to go on with this workflow only if the Issue Type that started it is of type 'Epic'.
Using this as a 'tip', I would like to write another similar single-line-script that checks how many linked issues there are in the Linked Issues 'field'. As I don't know exactly wich variables to check, I do not know how to do this.
As an example, just let's imagine that the variable that holds this value is named "LinkedIssues.size". Then, if I have something similar to "issue.LinkedIssues.size >=1", this boolean result would fit my needs.
Do you know exactly wich is the variable that I should check to build the small script?
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, my emails on followed questions have stopped arriving, so I've no way to see if people follow up, other than guess.
From memory, you need an issuelinkmanager object, then you can go
issueLinkManager.getIssueLinks(<issue>).size()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I use the JIRA Misc Workflow Extensions. It allows me to write very simple scripts to use in validations. As an example, I have the single-line-script "issue.issueTypeObject.name == 'Epic'" in one of my workflows that allows me to go on with this workflow only if the Issue Type that started it is of type 'Epic'.
Using this as a 'tip', I would like to write another similar single-line-script that checks how many linked issues there are in the Linked Issues 'field'. As I don't know exactly wich variables to check, I do not know how to do this.
As an example, just let's imagine that the variable that holds this value is named "LinkedIssues.size". Then, if I have something similar to "issue.LinkedIssues.size >=1", this boolean result would fit my needs.
Do you know exactly wich is the variable that I should check to build the small script?
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.