Forums

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

Send mail when a custom field date (Target Start) change

Swarna Radha
Contributor
August 31, 2018

Hi,

I want to send a mail when the custom field date ("Target start) changes.

 

Is this possible to check that each time the date changes, a mail is sent ?

 

Thanks

Swarna

1 answer

1 accepted

0 votes
Answer accepted
Tarun Sapra
Community Champion
August 31, 2018

Hello @Swarna Radha

You need a plugin for this feature to be implemented. I use Script runner's (paid plugin) listener feature for this, there are plenty of sample available for script listeners.

Tarun Sapra
Community Champion
August 31, 2018

Apart from Script runner there are other plugin like "Power Scripts" and "Automation for JIra" which can help you achieve your requirement but all of these are paid plugins.

Swarna Radha
Contributor
August 31, 2018

Hello @Tarun Sapra

I have used a script to verify the target date but the listener is not running.

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue


Issue issue = issue

//issue.getIssueType()== "Sub-task"
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issueManager = ComponentAccessor.getIssueManager()
def customField = customFieldManager.getCustomFieldObjectByName("Target start")
def originalIssue = issueManager.getIssueObject(issue.id)

issue.getCustomFieldValue(customField) != originalIssue.getCustomFieldValue(customField)

 

Thanks

Tarun Sapra
Community Champion
August 31, 2018

Have you used the Listener in the script listener section? Where have you added this code?

Swarna Radha
Contributor
August 31, 2018

Yes, I am using the listener in script listener. I have added the code in send a custom mail.

Please see screenshotCapture.PNG

Tarun Sapra
Community Champion
August 31, 2018

Can you Change this line

Issue issue = issue

to 

Issue issue = event.issue

 

Also, where are the logs? Please add some logs so we see what's exactly going on. Because issue update event is fired when you update an custom field. PLease add some logs

Swarna Radha
Contributor
August 31, 2018

@Tarun Sapra,

When i add the Issue issue = event.issue. I get error. Please see screenshot

capture 1.PNGThe event is not run so i am not able to get log.

Tarun Sapra
Community Champion
August 31, 2018

Do you get any mails from jira based on notification scheme when you update the custom field

Swarna Radha
Contributor
August 31, 2018

No, I am not getting any mails upon updating the custom field. The field "Target start" is a field from JIRA Portfolio and i am updating the field from JIRA Portfolio.

When i add target start from JIRA Portfolio, then I commit on it. Then the target start is updated.

Tarun Sapra
Community Champion
August 31, 2018

Since only now you share that it's a portfolio field, thus I can share that this might not work as not event is fired when you update the field on the plan view.

This is an open issue

https://jira.atlassian.com/browse/JPOSERVER-2268

Swarna Radha
Contributor
September 2, 2018

@Tarun Sapra.. thanks for the support

Suggest an answer

Log in or Sign up to answer