I would like to add a Validator on the Create transition of a Story that prevents the user from creating the Issue if A) the Parent field is empty, or B) if the Parent Issue status is "Done".
I have tried this ScriptRunner script, but it is not being triggered, and the validation automatically returns false:
if (issue.parent != null) {
return issue.parent.status.name != 'Done';
} else {
return false;
}
Any tips would be appreciated!
Thank you
Hi @Tom Yan ,
please try the following code :
if(issue.getParentObject()!=null) {
return "Done".equalsIgnoreCase(issue.getParentObject().getStatus().getName());
} else
return false;
Hope this helps,
Fabio
I am still receiving this error message when the Validator is triggered with the above code:
"timestamp": "2024-04-08T17:44:17.094Z",
"webhookEvent": "jira_expression_evaluation_failed",
"expression": "if(issue.getParentObject() != null) {\r\n return \"Done\".equalsIgnoreCase(issue.getParentObject().getStatus().getName());\r\n} else {\r\n return false;\r\n}\r\n",
"errorMessages": [ "Evaluation failed: \"issue.getParentObject\" - Unrecognized property of `issue`: \"getParentObject\" ('getParentObject'). Available properties of type 'Issue' are: 'assignee'
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.