Forums

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

Jira/Scriptrunner- Can the the change of a scripted field trigger a Listener ? (Send a custom email)

DORE September 22, 2021

Hi everyone !

I configured a scripted field that updates automatically when the due date has passed.

The goal of the scripted field is to trigger a listner, to send a custom email to the assignee, when the due date has passed without using the workflow.

I tried to use the listener Sen A custom Email but the update of the value of the scripted field is not considered as an issue event (Issue Updated).

I am limited with the add-ons, I only use ScriptRunner.

Maybe a script to automatically update the value of a custom field (not my scripted field) could be a solution ? And how to configure this automatically without action on the workflow ?

 

Thank you for all the answers you can provide !

 

Nathan

 

 

1 answer

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
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.
September 22, 2021

Actually, no, this won't work.

Scripted fields are not calculated on the fly, they are generated and stored when an issue is indexed.  A scripted field may well calculate something based on the due-date, but it won't actually change until the issue is changed in some way.

So there's nothing here to trigger a listener.

What you really need is a service - something that can run regularly and automatically, look for issues who should trigger something because the time has lapsed, and then run whatever it is that needs doing when the date passes.

The most simple case for this is best explained with an example.

Let's say

  • ABC-123 has a due date of the 40th Octember
  • You have a field called "due-soon" that is empty by default and not set on any screen for people to edit it manually

You would write a service that 

  • Runs at maybe 5 minutes past midnight every day
  • Runs a search for "due-soon is empty and due-date < +3d" 
  • For each issue found, set due-soon to "Yes"

When this runs, up to the 37th Octember, it'll do nothing with ABC-123, but on the 38th, it'll set the due-soon to "Yes", and then not update the issue again

DORE September 23, 2021

Thank you for your assistance regading this matter.

Can I program a script that is daily scheduled to search the due date with scriptrunner ?

I'm not an expert on the differents possibilities of scriptrunner

 

Nathan

Nic Brough -Adaptavist-
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.
September 23, 2021

Yes, you script a service.

You can find examples of running searches in scripts, and lots of other stuff over in https://library.adaptavist.com

DORE September 24, 2021

Thank you Nic !

Suggest an answer

Log in or Sign up to answer