Can I use originalIssue with cfValues in Builtin Script Listener Conditions ?

Hi there,

Hopefully this makes sense and it is not a stupid question. I am trying to check if a custom field value has changed to one of valid values and fire an email if so.

I have created a Builtin Script Listener with the condition:

cfValues['Documentation Status'] != 'None Required' && cfValues['Documentation Status'] != null

which works pretty good but the problem is that it fires the email at every update as long as the above condition is met not checking if the value has changed at all. And I don't want to fire an email if the value has not changed from the original value.

So something like the below would be nice :)

cfValues['Documentation Status'] != 'None Required' && cfValues['Documentation Status'] != null

&& cfValues['Documentation Status'] != originalIssue.cfValues['Documentation Status']

And naturaly that doesn't work :)

Any ideas ?

Cheers,

Baris

2 answers

Hi Baris

Something like this is working for me, try:

&& changeItems.any {it.get('field')=='Documentation Status'}

regards,

Paweł

def field = event.getChangeLog().getRelated('ChildChangeItem').any{ it.field.toString().equalsIgnoreCase("Documentation Status")}

if (field){

}

this will return bool value

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
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

685 views 1 18
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