It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Script to Update Custom field with last date.

I Have a EPIC and three stories in it.


Need to use a post-function or listner Script to update the Date field ( DUE DATE) of the EPIC.


1. The script needs to check DUE DATE field of the three stories.

2. The farthest date in the ( DUE DATE ) should be updated DUE DATE field of EPIC.


Any suggestions for the same. 

1 answer

1 accepted

1 vote
Answer accepted

Hi siva,

What about to place an Scripted field instead at the Epic level?


You must tune this code to fit your needs


* @Author: Jack Nolddor [Sweet Bananas] <>
* @Date: 06-Oct-2019
* @Description:
* Field that returns the further date from the configured linked issues
* You must to use Date Time Template
* You must to use Date Time Range picker Searcher
* See the link below for further details:

import org.apache.log4j.Logger
import org.apache.log4j.Level
import com.onresolve.scriptrunner.runner.customisers.PluginModule

def log = Logger.getLogger("com.nolddor")

IssueLinkManager issueLinkManager

// You must change the following variables as your needs
def sourceIssueTypes = ["Story"]
def excludeResolvedIssues = true

// Look for all linked issues
def linkedIssues = issueLinkManager.getOutwardLinks(*.destinationObject
// Remove undesired issue types
linkedIssues = linkedIssues.findAll{it -> sourceIssueTypes.contains(}
// Remove resolved issues, if applicable
linkedIssues = linkedIssues.findAll{!it.resolutionDate}
// Sort remaining linked issues by dueDate
// Return the further dueDate
return linkedIssues.last().dueDate




Let us know if the provided code snippet solves your problem,




Thanks, this does the job.


can you add a script line to check issues with are not closed or completed.

CLOSED issues should not be considered.

I've improved the given script to also remove the resolved issues ;) Enjoy!


Did my answer solve your problem?

If so, consider to mark the proposed solution as an 'Accepted answer'. This will help other people with the same or a quite similar problem to find a solution in a easy and faster way.
Otherwise, if you solved the problem in a way that hasn't been suggested yet in this thread, please I encourage you to reply your original message to tell us what was the final solution for the problem, you can also mark your own reply as an 'Accepted answer'.

In addition, by doing this the post will automatically gain the "Solved:" prefix in search results to indicate other people that no further support is needed.

Kind Regards.


THANKS, JACK,, that was quick.

I'm off work now, compiled against a ticket shows the right data.



I might need another script from you, will update the details ( similar to the present one)

few changes would do.

Glad to help, just summon me on the new thread if needed ;)

Happy coding!



You must to use Date Time Template
* You must to use Date Time Range picker Searcher

i have selected Date Time Template.


But When Date Time range picker serarcher im not able to create issues. 

Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you