scriptrunner send notification if the value of custom field change

AJ Magcale May 4, 2017

I need to fire a notification if the value of custom field changes.  I don't have a preference if it is a listener or post condition from the workflow.

Custom Field: Team - cf [10108].

Currently notifications are being sent with the default "issue update" which has generated too many notifications.

2 answers

0 votes
Balakrishna M June 29, 2018

I have faced the same issue , it has been resolved updating the Notification schema .

 

1. Create a new Notification Schema(you can copy it from the existing scheme)

2. Assign the Notification Scheme to your projects

3. Just Delete Issue Updated field (By Default Assignee , Reporter and Watchers), delete all the values . you will escape from this email noise.

 

Inorder to do the above one , you must have to get the Administrator permission

0 votes
JohnsonHoward
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.
May 10, 2017

Have you tried adding this condition to 'Fires event when condition is true' :

def condition = changeItems.any{it.field == "Name of Custom Field"}
return condition

AJ Magcale May 15, 2017

i've tried something similar:

Thanks for your help.  I am new to this.  I receive this error. 
No such property: changeItems for class: Script1

I was trying:

def change = changeItems.find {it.field == "Team"}
if (change) {
def oldValue = change.oldstring
def newValue = change.newstring
}

JohnsonHoward
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.
May 16, 2017

Is this in a script file or have you pasted it into the inline editor? 

AJ Magcale May 16, 2017

inline editor. from script console and script listeners

Jonny Carter
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.
May 17, 2017

changeItems won't be defined in the Script Console; it's only defined in the context of Script Listeners, specifically in the condition field. Do you really get an error there? If so, what version of ScriptRunner are you on, and can you provide a screenshot? I'm not seeing that in my instance.

Suggest an answer

Log in or Sign up to answer