Behaviors not behaving

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.

6 answers

This widget could not be displayed.

Can you post the xml of the behaviour you've got troubles with ?

Please see the code posted by my team mate Vaibhav below. Does that give you enough info to help us out?

This widget could not be displayed.

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

Please see the code posted by my team mate Vaibhav below. Does that give you enough info to help us out?

This widget could not be displayed.

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"

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.

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.

This widget could not be displayed.

Hi Jamie,

Thanks for your reply. I'll work on your suggestion and revert with the results.

This widget could not be displayed.

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?

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.

This widget could not be displayed.

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.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted 8 hours ago in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

21 views 0 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you