Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

ScriptRunner listener not working within Portfolio

I have a new listener listed below that copies the fixed deadline date down the portfolio hierarchy, but the date isn't showing up as changes within Portfolio.  The correct date shows up on the linked lira issues and in the issue search but not within Portfolio. Any suggestions as to why this would happen and how to correct it would be so helpful.

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 com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.issue.index.IssueIndexingService
import org.apache.log4j.Logger
import org.apache.log4j.Level

def log = Logger.getLogger("com.acme.FixedDeadlineDate")

Issue issue = event.issue

def key = issue.getKey()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issueManager = ComponentAccessor.getIssueManager()
def FDDfield = customFieldManager.getCustomFieldObjects(event.issue).find { == "Fixed Deadline Date" }
def issueService = ComponentAccessor.getIssueService()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def parentLink = customFieldManager.getCustomFieldObjectsByName('Parent Link')[0]
def customFieldValue = issue.getCustomFieldValue(parentLink)
def parentKey = (String) customFieldValue
def parentIssue = issueManager.getIssueObject(parentKey)
def parentValue = issue.getCustomFieldValue(FDDfield)
log.debug("ParentLink Value = " + customFieldValue)

def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchService = ComponentAccessor.getComponent(SearchService)
def jqlSearch = "issuetype in (Feature,'Forecasting Placeholder') and issuekey in childIssuesOf(" + key + ")"
def query = jqlQueryParser.parseQuery(jqlSearch)
def results =,query, PagerFilter.getUnlimitedFilter())
results.getResults().each {documentIssue ->;

def childIssue = issueManager.getIssueObject(
def changeHolder = new DefaultIssueChangeHolder()
def childValue = childIssue.getCustomFieldValue(FDDfield)
def issueIndexManager = ComponentAccessor.getComponent(IssueIndexingService)
FDDfield.updateValue(null, documentIssue, new ModifiedValue(childValue, parentValue), changeHolder)


1 answer

We have determined this isn't related to scriptrunner after all. This is directly related to Portfolio for Jira. We tested out this field within another environment that doesn't have the script in place and found that the date is not matching what is on the Jira Issue. It is actual off my one day. 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira Service Management

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

278 views 0 6
Join discussion

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