I'm trying to configure a JIRA plug-in called Behaviors to calculate a field by using data from two other fields. So far I've had no luck with the configuration or online help.
I am unable to figure out the exact issue here. Somehow, our script is unable to read the “formField” object. This object is supposed to be activated with Behaviors plugin as it (formField object) is not available with JIRA’s default classes:
https://developer.atlassian.com/static/javadoc/jira/6.0.5/reference/classes.html
Any guidance is helpful.
Oh, I thought that since the output filed is changing as per the script, we are required to set it to "Scripted Field"
Should I change the output field to "Text Field" if that will make it smooth?
You can use a behaviour to set a text field from other the values of other fields.
You can use a script field to display a value based on other fields.
The first approach lets the user override the value. Horses for courses.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie,
Where to get this option ID?
Also, the field which is being set depeding on the other two "Select List" fields is "Scripted Field".
Should I change the output field to text field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is not making any sense. You can't set the value of a scripted field.
You modify the script field code so that it returns a value based on the two select lists.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie,
Thanks for your reply. I'll work on your suggestion and revert with the results.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi guys,
I belive I have done proper mappings. Below is the simple behaviour's code we are facing trouble with:
F1 = getFieldByName('MyFieldInput1').getValue() F2 = getFieldByName('MyFieldInput2').getValue() FormField out = getFieldByName('MyFieldOutput') if (F1 == 'Likely' && F2 == 'Critical') { out.setFormValue("R1") }
Requirement: Based on the values set in MyFieldInput1 and MyFieldInput2, my 3rd JIRA input field's value should be influenced.
Like in above case if the values in MyFieldInput1 and MyFieldInput2 are "Likely" and "Critical" respectively, then my out JIRA field should have text value as: "R1"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What type of field is MyFieldOutput?
Add some logging, eg
log.warn ("F1: " + F1)
log.warn ("F2: " + F2)
and look in the jira log after activating the bejaviour.
Also please don't start your variables with an upper case char.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In private emails you said that all fields are select lists.
To set a select list value you will need to send the option ID, which is like 12345.
This is not ideal but this is how it works right now. Maybe in future there will be a setValue() method, like the getValue() method, which has a bit more smarts.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Josh,
here some examples https://jamieechlin.atlassian.net/wiki/display/JBHV/JIRA%20Behaviours%20Plugin#JIRABehavioursPlugin-Setonefieldbasedonanotherfieldwithinformationprovidedbytheserver
If you provide us your code we can help you on that.
Please make sure that you defined a correct mapping (project/issue type) for your behaviour.
Hope this helps,
Fabio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please see the code posted by my team mate Vaibhav below. Does that give you enough info to help us out?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you post the xml of the behaviour you've got troubles with ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please see the code posted by my team mate Vaibhav below. Does that give you enough info to help us out?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.