weird behaviour when using getFieldChanged in scriptrunner

I'm currently running on JIRA 6.3.1 and 3.0.16 of ScriptRunner and seeing a weird behaviour.

 

I'm trying to detect which field changed with the below code.

 

 

def cusField = getFieldById(getFieldChanged())

 

log.debug("Form field object returned is: " + cusField)

 

def newValue = cusField.getValue()

 

log.debug("Form field object returned is: " + cusField)

 

I then go and make a change in a customfield but when I look at the logs for the debug output I see it saying another field changed.

 

Any ideas what can be going on?

 

Thanks in advance.

 

1 answer

This widget could not be displayed.

Hi Randy

So the getFieldChanged() always returns the field ID of the field the behaviour fires for. So for example if you have assigned a behaviour in the Description field, the following condition will be true.

getFieldChanged() == "description" //id for the field Description

Hope that makes sense

regards, Thanos

 

Thanks for the quick response Thanos. Sorry to ask a follow up question but going with your description field example, if description field is not updated should this behaviour still proceed? That is what it seems like is happening to me. I update another field yet I still see this behaviour in the log file printing out.

 

Thanks in advance.

Hey Randy,

No this shouldn't happen. Could you please attach a screenshot of your behaviour's configuration ?

Is this what you were referring to? Or did you need more?

image2017-1-30 9:26:58.png

cheers Randy that's enough, I'll have a look later.

Thanks Thanos!

Hi Randy,

Apologies for the delayed response. I did give it a chance and could not reproduce this. Do you have any other behaviours assigned (maybe a clash between them) ?

regards, Thanos 

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 yesterday in Statuspage

What are your best incident management tips and stories? #HugOps

 👋Community members! Downtime happens. And great incident response takes a village. Teams like Support, Dev, SRE, Ops, IT, and Marketing have to come together to resolve the problem while keep...

69 views 2 3
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