Business Justification: As a Product Owner of Project TIA, I need to be able to view the DateTime stamp of any story that has been put into the sprint after it has started, so that I can ensure the engineering teams are working on the right things and set the appropriate expectations with our business users.
I am trying to use Scripted Listener in which we can trigger events "Sprint Property Set Event" and I am trying to use the below script.
But the script is not working as expected.
Script:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import java.sql.Timestamp
Issue issue = issue
def change = event?.getChangeLog()?.getRelated("ChildChangeItem").find {it.field == "Sprint"}
if (change) {
def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Sprint Added")
def changeHolder = new DefaultIssueChangeHolder()
def now = new Timestamp(new Date().getTime())
cf.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(cf), now),changeHolder)
}@A @Thanos Batagiannis [Adaptavist] Please help me out
Is it working if you edit event type to "Issue updated"?
Nope its not.
Is there any issue in the script? Which I am missing
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I always suggest to add "logging" to the script. It can answer following questions
You can use log.error("something") and read your log files.
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.