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
If you see Actual Start date ie is earlier than scheduled start date, this should not be allowed. I'm also setting Actual start date in post function when the user goes to In Progress. Not sure if that helps you analyze the problem
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you send me a snap of what error it shows when you try to transition? It's supposed to prevent you from transitioning
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Saira , I just tested it on cloud and it works correctly for me. Did you publish your updated workflow? :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I will try it , but before I do, how do I add a custom error message instead of the default one? this is what I want to display
You cannot work on this issue until the scheduled start date has arrived.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Saira unfortunatelly you cannot add custom message to this validator. In this case you would need to install some App from Marketplace which has custom validator implemented (I know ScriptRunner can do it).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Saira you have more documentation to Script runner validators here:
https://docs.adaptavist.com/sr4jc/latest/features/workflow-extensions/validators
Can you check it and try to write some script and get back to me with some basic snippet of the code?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
issue
.parent
.subtasks
.filter( st => st.labels.includes("label_X")[0]
.assignee.accountId != issue.assignee.accountId
Please note the [0] 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 [0].
Hope that helps,
Oliver
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.
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.