Hi everyone,
I'm working with ScriptRunner Behaviors in Jira Cloud and need help implementing a field dependency. Specifically, I want to make the 'App Version IOS' field mandatory when the 'Platform' field is set to 'IOS', and make the 'App Version Android' field mandatory when the 'Platform' field is set to 'Android'.
I've tried using the following Groovy script within a Behavior's validator:
However, I'm encountering a few questions:
Any guidance or examples would be greatly appreciated!
Thanks in advance
Hi Gunawan,
I can confirm that behaviours would be the correct approach if you wanted to make fields required on screens.
If you used workflow validators you could this during transitions and pop up transition screens but not do dynamic field level control on screens like you can achieve with behaviours.
However, in Jira Cloud, behaviours are slightly different as they are written in JavaScript and not in Groovy like on the on-premise versions, which your screenshot shows.
Please note behaviours do not support all project types or field types in Jira Cloud currently and you can see what project types and fields are supported in the documentation page located here.
Also, you can see examples of behaviours scripts in Jira cloud in the page here and the examples below will be a good reference to help you to create the script that you require.
I hope this information helps.
regards,
Kristian
Hi Kristian,
Thank you for responding my concern, following your writing above, how to confirm which Jira services that my company are using ? I've read in some blog it says when the domain is https://company.attlassian.net then this indicate it is a Jira Cloud that is why I was using Groovy instead of Javascript.
Also, because my code is not working in Script Runner keep getting bugs and though bugs is solved but unable to save to it in Script Runner, I decided to put the code in Jira Workflow instead of Behaviour in Run Script, this also not achieving the goal of "making a field required".
Releted to this, what is the difference between Jira Workflow and Script Runner if within Jira Workflow I can also add Script Runner in Worklfow Validator
Regards,
Gunawan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gushwan,
You are correct that when it is .atlassian.net domain that it is Jira Cloud.
However, in Jira Cloud behaviours use Javascript as documented here which means you wlll need to write it similar to the example I shared.
As mentioned in my previous post, if you use a workflow, it will only work when an issue is transitioned, and Workflow Validators will only apply during a transition.
Behaviours will apply on issue screens such as the create screen, view issue screen or transition screen and that is the difference.
If you need further assistance writing your behaviours script, then please raise a support ticket here, so that our support team can assist with this.
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.