You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi Team,
We have a requirement to update a custom filed "Due Date Provided On" with the date on which "Due Date" field is populated.
Below is the actual requirement, how can we implement this?
Case | “Due Date” field in JIRA | “Due Date Provided On” field in JIRA |
XYZ-123 is created with no Due Date | <empty> | <empty> |
User A adds the Due Date of 1-Jan-2020 to XYZ-123 on the 31-Oct-2019 | 01/01/2020 | 31/10/2019 |
User B deletes the Due Date on the 5-Nov-2019 | <empty> | 31/10/2019 |
User A adds the new Due Date of 5-Jan-2020 to XYZ-123 on the 10-Nov-2019 | 05/01/2020 | 10/11/2019 |
Hi @Neenu jose ,
Here is a script you can use for your need :
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import java.sql.Timestamp
def dueDateChanged = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == "duedate"}
if (issue.getDueDate() != null){
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def dueDateProvidedOnId = 12500
def dueDateProvidedOn = customFieldManager.getCustomFieldObject(dueDateProvidedOnId)
def dueDateProvidedOnValue = issue.getCustomFieldValue(dueDateProvidedOn)
dueDateProvidedOn.updateValue(null, issue, new ModifiedValue(dueDateProvidedOnValue, new Timestamp(new Date().getTime())), new DefaultIssueChangeHolder())
}
Use a script listener on the "Issue Updated" event, and any additional event where you are likely to change the due date.
Also add a script post function in the create transition, use this script while removing this line :
def dueDateChanged = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == "duedate"}
Let me know if that helped.
Antoine
hi @Neenu jose ,
Did that work for you ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.