Hi there. I have the following scenario where I wonder ScriptRunner's Behaviour feature can help with the following two fields:
Use case:
The documentation doesn't really seem to cover this particular scenario. Anyone have any thoughts?
Hi Ricky,
I can confirm that this is possible with Behaviour.
Here is an example of your use case:
1 - Create a Behaviour and map to a project and issue type.
2 - Add a field 'Code Location' and toggle 'Shown' to make it 'Hidden'
3 - Add a field 'Require Code?' and add the following server-side script:
def requireCode = getFieldById(getFieldChanged())
def requireCodeValue = requireCode.getValue()
def codeLocation = getFieldByName("Code Location")
if ('Yes' in requireCodeValue) {
codeLocation.setHidden(false)
codeLocation.setRequired(true)
} else {
codeLocation.setHidden(true)
codeLocation.setRequired(false)
}
I hope the above helps! :)
Cheers,
Helmy
Hi Helmy. Thank you so much. I followed your steps to the tee and it works exactly as expected.
Thank you so much for the screenshots and detailed guidance!
Question: Apart from the documentations, is there anywhere else I could look at to get better at using ScriptRunner? Specifically, how to do some of the coding to satisfy some common use cases based on examples.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ricky,
You're very welcome! I guess you can check out the Adaptavist Library and it is essentially a collection of scripts based on common use cases. And be sure to check the Tutorials section in the docs.
And of course, the Community! :)
We also have a YouTube channel where we upload solutions to a specific use case from time to time. If you're new to the product and scripting, I'd recommend this webinar.
If I have helped you with my first answer, please accept it to raise its visibility.
Cheers,
Helmy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Helmy Ibrahim _Adaptavist_ ,
How do I get this to work with a Select List (Cascading)? Only what is in the parent element (first dropdown) counts as a trigger. The content of the child elements should have no influence.
Thanks :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Cascading field returns a list where the first element is the parent's value. So, you can do it like the below:
def cascadingField = getFieldById(getFieldChanged())
def fieldValue = cascadingField.getValue() as List
def parentValue = fieldValue[0] // Use [1] to get the child's value
if (parentValue == 'parent value here') {
// do something
}
Regards,
Helmy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Helmy Ibrahim _Adaptavist_,
thank you so much. That helped a lot. Now everything is working as expected. :)
Best regards
Marco
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline 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.