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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published yesterday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

42 views 0 3
Read article

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