The new JIRA has been installed and i am facing the issue in script-runner. I m searching for 4 days.
The two point is provided below which i need to fix:
1. I am unable to restrict for update the value of an issue at the time of issue update event. I had created a script on script listener.
2. Instead of hard coded value for key, i want to use dynamic code on script-runner. Means if the ticket is sub-task issue and project will be the same then the below script will execute.
Here the script is provided below and the requirement is duedate value for Task IssueType should be greater than the Duedate value for n number of subtask IssueType :
@BaseScript ContextBaseScript script
Issue issue = getIssueOrDefault("TEST-258") // Hard coded issue-key defined
if(issue.parentObject.dueDate.compareTo(issue.getDueDate()) >= 0)
UserMessageUtil.success("Due Date Success"+issue.dueDate)
UserMessageUtil.success('Please enter the Subtask duedate that is less than Parent-Task Due-Date ')
//throw new InvalidInputException("Input not valid")
The problem is that when the condition fails then the date will be update first and next the pop up alert is raised which i mentioned in the code but I am unable to restrict the due date update. Also recommend us for second point on run-time environment(on production).
Hi @Kalyan Kumar Das ,
So your requirement is to prevent the Subtask from being created/saved if the Due Date of the Sub-task is greater than the Due Date of parent task?
Then you should use Behaviour to validate it from being created/saved in the first place.
Issue Updated event in the listener assumes that the value is already saved as opposed to preventing it from being saved.
@Nic Brough _Adaptavist_: I am not getting your point. Request you to elaborate the same.
Because i had already used the validator on the create(sub-task) transition. And it is working fine at the time of creating the issue but it is not working at the time of issue update event.
May be i missed something in the code?
But the code you've given us
So it's always going to pass validation
Could you give us the actual code?
And also bear in mind that a validator only executes on the transition it is on. Editing an issue is not a transition.
A listener has no validators itself, it runs when an event is detected. It is up to you to put code in to detect if you want to do things selectively.
Listeners do not have any UI interaction. They can't - they're not being run on the UI, they run in the background when events happen.
The code you've shown us is a validator, not a listener.
I think we need to take a step back. Forget the code you have, and tell us what you're actually trying to achieve? What do you want the user to experience?