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

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
Community showcase
Posted Tuesday in Statuspage

Introducing Statuspage Getting Started guides! First up: What is Statuspage?

Over the next several weeks we'll be sharing some of our Getting Started guides here in the community. Throughout this series of posts, we'd love to hear from customers and non-customers ab...

191 views 4 1
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