Hi everyone, I am new in Scriptrunner and I will love your help.
I have an issue type A, and on the view screen there is a button to create issue type B. Issue type B is a child of issue type A. When creating issue type B, there is a select list field to fill.
What I need to do is: When the button to create issue B is clicked, and value is selected from the list, check in parent A if there is a child B with the selected value. If so, don’t allow to create this issue B, and an alert will pop up
I thought to create a behavior script, but I’m stuck on how to even get started. How to get the parent ID? How to know when the button is clicked, and value is selected?
Thank you for your time and help!
Aviv
Hi @aviv_eldad
You can add a validator (Scripted (Groovy) Validator) on your workflow and enter a similar groovy script:
issue.parentObject.get("customfield_16950") == "Value 2"
I used the above with JMWE where customfield_16950 is your single select field and the "Value 2" is the value you want to check it against. If the above expression is true, only then the workflow can proceed.
Place the above validator on the create screen of your subtask's workflow. Let me know if that works out for you!
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.