weird behaviour when using getFieldChanged in scriptrunner

Randy January 30, 2017

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

1 vote
Thanos Batagiannis _Adaptavist_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 30, 2017

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

 

Randy January 30, 2017

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.

Thanos Batagiannis _Adaptavist_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 30, 2017

Hey Randy,

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

Randy January 30, 2017

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

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

Thanos Batagiannis _Adaptavist_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 30, 2017

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

Randy January 30, 2017

Thanks Thanos!

Thanos Batagiannis _Adaptavist_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 20, 2017

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