Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

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
Published in Bamboo

Bamboo Data Center Apps Program coming soon

G’day Bamboo customers, As we approach GA for Bamboo Data Center , we would like to inform you that the Data Center Apps Program for Bamboo starts this quarter. How long does it take? We are g...

66 views 0 6
Read article

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