Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to write condition when Custom field changes value

Wojciech Górski July 20, 2020

Hello!

I have problem with writing a condition in Script Listener.

I have CF called "Investment" - it have 3 options: "Required", "Not required", "I am not sure".

I want to write a condition, which checks when field "Investment" is changing value from "Not required" to one of the others and then create linked issue in other project.


Now I have created listener only on "Create issue" event

Confition looks like that:

cfValues['Investment']?.value == "Required" ||
cfValues['Investment']?.value == "I am not sure"

 

, but I want to have when task is even edited and it have changed "Investment" value.
It is possible?

 

1 answer

1 vote
Dar Kronenblum
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.
July 20, 2020

Hi
in this case you should use issue update event and get the changed fields:

List <Map> changes=event?.getChangeLog()?.getRelated("ChildChangeItem") as List

 

you can get the fields :

 def field=change.field

 and their new and old values:

change?.oldstring
change?.newstring 

good luck :) 

Suggest an answer

Log in or Sign up to answer