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.
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] <support@sweetbananas.es>
* @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:
* https://community.atlassian.com/t5/Jira-questions/Script-to-Update-Custom-field-with-last-date/qaq-p/1196044
*/
import org.apache.log4j.Logger
import org.apache.log4j.Level
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.atlassian.jira.issue.link.IssueLinkManager
def log = Logger.getLogger("com.nolddor")
log.setLevel(Level.DEBUG)
@PluginModule
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(issue.id)*.destinationObject
// Remove undesired issue types
linkedIssues = linkedIssues.findAll{it -> sourceIssueTypes.contains(it.issueType.name)}
// Remove resolved issues, if applicable
if(excludeResolvedIssues)
{
linkedIssues = linkedIssues.findAll{!it.resolutionDate}
}
// Sort remaining linked issues by dueDate
linkedIssues.sort{it.dueDate}
// Return the further dueDate
if(linkedIssues)
{
return linkedIssues.last().dueDate
}
Let us know if the provided code snippet solves your problem,
Regards
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jack Nolddor _Sweet Bananas_
THANKS, JACK,, that was quick.
I'm off work now, compiled against a ticket shows the right data.
WORKS..!!
I might need another script from you, will update the details ( similar to the present one)
few changes would do.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad to help, just summon me on the new thread if needed ;)
Happy coding!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you check the error query i have created.
https://community.atlassian.com/t5/Jira-Software-questions/Cannot-create-issue-after-adding-Scripted-field/qaq-p/1196274#M55219
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.