I set up a behaviour to make a field mandatory when another field is set to a certain value. The behaviour works, but I need to switch issuetype back and forth for the required condition to update.
This is my server side script:
"
"
I tried to set it to run on Workflow Action:Create (1) and without, but does not change anything. Not sure what I'm missing?
You need to attach the script to the field you want to react on. I assume you currently have this on an Initializer - which will only run once (that is why it works once you switch the forms w/ issue type, it reloads the initializer).
Add the field you're reacting on, then attach the script to it. It should then fire that script every time that you modify the field.
(If you want the "text format" from the select list, then field#getFormValue() should do that I believe)
Thank you! I was actually attaching the script to the field I was setting to mandatory instead of the field I was reacting on.
Works great now!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bojan Virag
If script doesn't work, can you try this?
String field1Val = (String) field1.getValue()
field1.setHelpText("Value: " +field1Val)
It will show you the value in create screen (for debug purpose).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Tansu Akdeniz thank you, this is very helpful!
default value is Value: Form field ID: customfield_12300, value: -1
When I change field1 nothing happens, but then if I change the issue type, value changes to Value: Value: Form field ID: customfield_12300, value: 17449
Also this is a single select drop down text field, I was expecting text to be returned.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are welcome! So, comparing value instead of text should solve.
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.