I am using a simple Simple scripted validator option to validate the Acceptance Criteria field mandatory over a workflow transition however the code is not working in some combination of operators.
Not working code
{code}
issue.projectObject.key == 'AAAA' || cfValues['Acceptance Criteria'] == null
OR
issue.projectObject.key == 'AAAA' && cfValues['Acceptance Criteria'] == null
OR
issue.projectObject.key == ['AAAA', 'BBBB'] && cfValues['Acceptance Criteria'] == null
{code}
Also not able to use validator code for multiple projects that mean the same code is added multiple time for diffrent projects to validate the same field in the same transaction.
Working code
{code}
issue.projectObject.key != 'AAAA' && cfValues['Acceptance Criteria'] != null
{code}
How come "!=" operator working perfect for here.
Hi @Rajiv Ranjan ,
Not sure exactly which condition you are trying to achieve, but this should work :
issue.projectObject.key in ['AAAA', 'BBBB'] && cfValues['Acceptance Criteria'] == null
Antoine
Thank you for your response but this code not working
issue.projectObject.key in ['AAAA', 'BBBB'] && cfValues['Acceptance Criteria'] == null
The below code is working for an individual project but it' confusing because using "!=" operator. Attached the working code screenshot
issue.projectObject.key != 'AAAA' || cfValues['Acceptance Criteria'] != null
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am not sure to understand your need, could you please specify your requirement so I can answer as best as I can ?
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am trying to achieve the Acceptance Criteria field mandatory over a workflow transition (from In Definition to Open). To achieve that I user Simple scripted validator option over the transition validator however it's not working as expected.
Note: Upon transition from "In Definition" to "Open", in case users didn't fill in the field, they will get an error message and will be required to click “Edit” and enter the acceptance criteria in order to proceed
issue.projectObject.key in ['AAAA', 'BBBB'] && cfValues['Acceptance Criteria'] == null
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So if you want the validator to check if the Acceptance Criteria is not empty, and to execute only for projet AAAA and BBBB, you would need :
issue.projectObject.key in ['AAAA', 'BBBB'] && cfValues['Acceptance Criteria'] != null
Antoine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, the code is working.
Also learned it doesn't matter how we using operators but it should script returns a False value then the transition will be blocked with the error message.
Below both codes are working.
(!(issue.projectObject.key in ['AAAA', 'BBBB', 'CCCC'])) || cfValues['Acceptance Criteria'] != null
issue.projectObject.key in ['AAAA', 'BBBB', 'CCCC'] && cfValues['Acceptance Criteria'] != null
Thanks for your time and assistance.
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.