I want to compare the field named Scheduled start date with current time and prevent transition if this condition is not true. But when I put it in the workflow validator, it does not prevent going forward
Hi @Saira , sure, the error message looks like:
But I think your configuration is wrong. Your configuration is
If I understand it correctly, you need the oposite
Let me know if it works :)
Thanks. I actually do have Scriptrunner. I also have one more question
I have a parent issue that has two subtasks - suppose task A and task B
I want task B's assignee to not be the same as task A's. Task A has a label, let's call that X.
How do I write a scriptrunner script to restrict transition of task B if task A and B have the same assignee ?
Hi @Saira you have more documentation to Script runner validators here:
Can you check it and try to write some script and get back to me with some basic snippet of the code?
Thanks, here's what I need:
issue.parent."subtask with the label".assignee.accountId != issue.assignee.accountId
but I don't know what to put in place of "subtask with the label".
Basically, I need to retrieve the subtask that has that label, and then compare that subtasks's assignee to the current issue's assignee. The doc's don't really help much here.
Hi @Saira ,
For any validator in any cloud app, you would use Jira Expressions. What you've written is already almost what you need :)
The subtasks attribute is a list that contains all subtasks. You only want the one with a certain label, so you'll have to filter it. This can be done like this:
.filter( st => st.labels.includes("label_X")
.assignee.accountId != issue.assignee.accountId
Please note the  at the end of the filter() function: filter() returns a list because you could potentially have more than one subtask with that label. If you are certain that it's really only ever going to be the one subtask, you can pick the first one from the list with .
Hope that helps,
P.S. Jira Expressions are a fantastic way not only to build conditions and validators, but also to play around with issue data and even aggregate data from multiple issues. If you like them, let me recommend our free app Expression Tester, that lets you play around with Jira Expressions right from the UI.