Hello everyone,
I'm trying to create a validator using Scriptrunner and so far I came up with the following expression:
(issue?.isEpic == false && issue?.customfield_10100 =! null) ? ( (issue?.customfield_10100.value == "Sim" && issue.epic != null) || (issue?.customfield_10100.value == "Não") ) : false
This works when the custom field 10100 is on the screen, but I have a few cases where the screen for the issue type in the same workflow does not have the custom field and the transition breaks
Is there a way to make this validation works only for the screens that have the field?
Hi Thais,
Thank you for your question.
I can confirm that unfortunately validators cannot be configured for only specific screens containing specific fields as the Jira Expression framework from Atlassian, which ScriptRunner for Jira cloud uses to provide validators does not support this.
The Jira Expression API has a hasScreen property that can check if a transition has a transition screen but this does not support checking what fields exist on that screen during the transition.
This means the only way to solve this is to create a new workflow for the projects that require the screen and the field and this to just these projects so that projects which do not use this field are not impacted.
I hope this information helps.
Regards,
Kristian
Thank you for the reply Kristian
Do you know if I can change de first part of the expression to filter for issue types that are standart issue types?
instead of
issue?.isEpic == false
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thais,
Yes, you can check for certain issue types and I can confirm in the examples here, that the first expression on line 46 shows how to check if an issue type is a certain type such as a story or task.
I hope this helps.
Regards,
Kristian
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.