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
4,293,502
Community Members
 
Community Events
165
Community Groups

cannot find setCustomFieldValue method

Hello all, I'm trying to use scriptrunner to create a listener that triggers when the "Target start" field (from advanced roadmaps) on an Epic is updated.  The goal is to update the same field on all of that epic's children.

I attached the script below to a listener and it fires when I make a change to the field, but the field on the epic's children are not updating.  The "setCustomFieldValue()" and "updateIssue()" in the if(change) block are both throwing errors:

 

cannot find matching method com.atlassian.jira.issue.Issue#setCustomFieldValue(com.atlassian.jira.isue.field.java.lang.Object). Please check if the declared type is correct and if the method exists

 

I don't know how to either resolve this, or set the field using a different method.

-------------------

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.util.ImportUtils
import com.atlassian.jira.issue.index.IssueIndexingService
import com.atlassian.jira.event.type.EventDispatchOption

def linkType = "Issue in Epic"


def linkMgr = ComponentAccessor.issueLinkManager
def cfManager = ComponentAccessor.customFieldManager
def issueManager = ComponentAccessor.issueManager
def issueIndexingService = ComponentAccessor.getComponent(IssueIndexingService.class)

def issue = event.issue

def currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser

def TSField = cfManager.getCustomFieldObjects(issue)?.find{it.name == "Target start"}
def cfValue = issue.getCustomFieldValue(TSField)
def epicLink = cfManager.getCustomFieldObjectByName("Epic Link")
def epicName = cfManager.getCustomFieldObjectByName("Epic Name")

def change = event?.changeLog?.getRelated("ChildChangeItem")?.find{it.field == TSField}

if (!change){
return
}

def linkedIssue = linkMgr.getOutwardLinks(issue.id).findAll{it.issueLinkType.name == linkType}

if (!linkedIssue){
return
}

if (change){
linkedIssue.each{
def linkedIssueObj = it.destinationObject
linkedIssueObj.setCustomFieldValue(TSField, cfValue)

issueManager.updateIssue(currentUser, linkedIssueObj , EventDispatchOption.DO_NOT_DISPATCH, false)

def wasIndexing = ImportUtils.isIndexIssues()
ImportUtils.setIndexIssues(true)
issueIndexingService.reIndex(linkedIssueObj)
ImportUtils.setIndexIssues(wasIndexing)
}
}

1 answer

1 accepted

3 votes
Answer accepted
Tuncay Senturk Community Leader May 03, 2022

Hi @padraik 

I haven't checked every line of the code. 

setCustomFieldValue is a method of MutableIssue class. Could you please try casting Issue to MutableIssue?

In order to do that you have to add an import

com.atlassian.jira.issue.MutableIssue

then cast the issue object to MutableIssue 

MutableIssue linkedIssueObj = (MutableIssue) it.destinationObject
linkedIssueObj.setCustomFieldValue(TSField, cfValue)

I hope it helps!

That solved my errors, thank you!  (I had been looking for documentation for setCustomFieldValue, where did you find that?)

Unfortunately, my Epic's children are still not updating their "Target start" field to match when the script runs.  The good news is it fires when I update the field.  I just have to figure out how to make the updates.

Tuncay Senturk Community Leader May 03, 2022

I did not find it, I knew it from the past experience. Here is the javadoc for the MutableIssue class and Issue class. You can check their methods there.

Could you please accept the answer to mark it as resolved?

Thanks

Gladly, thanks again.

Is there any way I could further inconvenience you to look through the script to see if anything jumps out as to why my Epic's children wouldn't be updating?

---------------- Newly updated script below, including your original changes:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.util.ImportUtils
import com.atlassian.jira.issue.index.IssueIndexingService
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue

def linkType = "Issue in Epic"


def linkMgr = ComponentAccessor.issueLinkManager
def cfManager = ComponentAccessor.customFieldManager
def issueManager = ComponentAccessor.issueManager
def issueIndexingService = ComponentAccessor.getComponent(IssueIndexingService.class)

def issue = event.issue

def currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser

def TSField = cfManager.getCustomFieldObjects(issue)?.find{it.name == "Target start"}
def cfValue = issue.getCustomFieldValue(TSField)
def epicLink = cfManager.getCustomFieldObjectsByName("Epic Link")
def epicName = cfManager.getCustomFieldObjectsByName("Epic Name")

def change = event?.changeLog?.getRelated("ChildChangeItem")?.find{it.field == TSField}

if (!change){
return
}

def linkedIssue = linkMgr.getOutwardLinks(issue.id).findAll{it.issueLinkType.name == linkType}

if (!linkedIssue){
return
}

if (change){
linkedIssue.each{
def linkedIssueObj = (MutableIssue) it.destinationObject
linkedIssueObj.setCustomFieldValue(TSField, cfValue)

issueManager.updateIssue(currentUser, linkedIssueObj , EventDispatchOption.DO_NOT_DISPATCH, false)

def wasIndexing = ImportUtils.isIndexIssues()
ImportUtils.setIndexIssues(true)
issueIndexingService.reIndex(linkedIssueObj)
ImportUtils.setIndexIssues(wasIndexing)
}
}

Tuncay Senturk Community Leader May 03, 2022

It is really hard to see what the problem is but what I'd do first thing is to add some warning logs in order to trace and understand whether

- the change variable's value is true

log.warn ("change: $change")

- it reaches the block with setCustomFieldValue 

log.warn ("linkedissue: $linkedissue.key")
Tuncay Senturk Community Leader May 03, 2022

Please let me know the result and I may have a further look.

2022-05-03 15:18:32,004 WARN [runner.ScriptBindingsManager]: change: null

 

you have my continued thanks

So change is null... I'm still new to groovy and did not write this line, so I don't understand it well, but it's probably the problem.

def change = event?.changeLog?.getRelated("ChildChangeItem")?.find{it.field == TSField}

Tuncay Senturk Community Leader May 03, 2022

Where in the code did you put that log?

It should be as below

def change = event?.changeLog?.getRelated("ChildChangeItem")?.find{it.field == TSField}
log.warn ("change: $change")
Tuncay Senturk Community Leader May 03, 2022

How about this one?

def change = event?.changeLog?.getRelated("ChildChangeItem")?.find{it.field == "Target start"}
Tuncay Senturk Community Leader May 03, 2022

Btw, I did not understand the scenario but I'm trying to help based on your code.

If "Target start" custom field changes then the code will update the same custom field for the child issues of the epic.

Like padraik likes this

Yes, that is the correct functionality 

The log was in the right place, but your suggestion to use "Target start" instead of TSField made it return as not null

The code block with setCustomFieldValue still does not run, however

Here is what the log returns when the script runs:

 

 

 2022-05-03 15:49:51,596 WARN [runner.ScriptBindingsManager]: change: [newvalue:2022-03-12, field:Target start, oldstring:03/12/2022, newstring:03/13/2022, id:1275519, fieldtype:custom, oldvalue:2022-03-11, group:960286]

I added a log.warn and confirmed that the if(!linkedIssue){return}

Is firing and that's why it doesn't make it to the end

I fixed that by checking if(linkedIssues==null) instead of if(!linkedIssues)

It is not executing the linkedIssue.each{} code block

The first log.warn fires ("trying to start the each loop"), but the second one ("WE'RE IN THE EACH LOOP") does not


if (change != null)
{
log.warn ("Trying to start the each loop")

linkedIssue.each
{
log.warn ("WE'RE IN THE EACH LOOP")

def linkedIssueObj = (MutableIssue) it.destinationObject
log.warn ("linkedissue: $linkedIssueObj.key")
linkedIssueObj.setCustomFieldValue(TSField, cfValue)

issueManager.updateIssue(currentUser, linkedIssueObj , EventDispatchOption.DO_NOT_DISPATCH, false)

def wasIndexing = ImportUtils.isIndexIssues()
ImportUtils.setIndexIssues(true)
issueIndexingService.reIndex(linkedIssueObj)
ImportUtils.setIndexIssues(wasIndexing)
}
}
Tuncay Senturk Community Leader May 04, 2022

Hi,

it seems that it does not fetch the stories related to the epic. It might be because of

- the link name might be wrong

- the link from epic to stories might be wrong (it can be outward as well as inward)

- the issue you are testing the listener code might not be an epic

What I would suggest is to use the below code to trace and see the exact link name.

 

def linkedIssue = linkMgr.getOutwardLinks(issue.id)

linkedIssue.each{
log.warn ("linkedIssueObj: $linkedIssueObj.key" )
log.warn ("link type: $it.issueLinkType.name" )
}
Like padraik likes this

I will try this and let you know, thanks!

Like Tuncay Senturk likes this

My script works now!

I replaced my line:


def linkedIssue = linkMgr.getOutwardLinks(issue.id).findAll{it.issueLinkType.name == linkType}

With yours:

def linkedIssue = linkMgr.getOutwardLinks(issue.id)

 and after that, the linkedIssue.each loop ran correctly :)

Thank you for all your help

Tuncay Senturk Community Leader May 05, 2022

@padraik 

It was not meant to make it work. I just wanted to see the link-type names. Your code does not work accurately right now, it runs for every link of the issue. However, you only want to update issues of the epic.

Please share the logs of the code and we will see the exact names of the link types and correct the code accordingly.

I see what you're saying... also I'm not sure what has happened since last week, but when I try to run the script now, it fails and I get logs that truncate because they are over 300 lines:

Sorry in advance.

 

at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.servicedesk.internal.web.ExternalCustomerLockoutFilter.doFilter(ExternalCustomerLockoutFilter.java:55)
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.greenhopper.jira.filters.ClassicBoardRouter.doFilter(ClassicBoardRouter.java:56)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.mywork.client.filter.ServingRequestsFilter.doFilter(ServingRequestsFilter.java:32)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.jira.plugin.mobile.web.filter.MobileAppRequestFilter.doFilter(MobileAppRequestFilter.java:59)
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.jira.plugin.mobile.login.MobileLoginSuccessFilter.doFilter(MobileLoginSuccessFilter.java:54)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.diagnostics.internal.platform.monitor.http.HttpRequestMonitoringFilter.doFilter(HttpRequestMonitoringFilter.java:55)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.analytics.client.filter.UniversalAnalyticsFilter.doFilter(UniversalAnalyticsFilter.java:75)
at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:33)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.prettyurls.filter.PrettyUrlsSiteMeshFixupFilter.doFilter(PrettyUrlsSiteMeshFixupFilter.java:32)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.prettyurls.filter.PrettyUrlsDispatcherFilter.doFilter(PrettyUrlsDispatcherFilter.java:55)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.prettyurls.filter.PrettyUrlsSiteMeshFilter.doFilter(PrettyUrlsSiteMeshFilter.java:80)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.prettyurls.filter.PrettyUrlsMatcherFilter.doFilter(PrettyUrlsMatcherFilter.java:51)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.labs.botkiller.BotKillerFilter.doFilter(BotKillerFilter.java:35)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:55)
at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:43)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.jira.web.filters.MobileAppRequestFilter.doFilter(MobileAppRequestFilter.java:36)
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.jira.web.filters.accesslog.AccessLogFilter.executeRequest(AccessLogFilter.java:93)
at com.atlassian.jira.web.filters.accesslog.AccessLogFilter.doFilter(AccessLogFilter.java:79)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:181)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:85)
at com.atlassian.jira.web.filters.SitemeshPageFilter.doFilter(SitemeshPageFilter.java:112)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.jira.web.filters.pagebuilder.PageBuilderFilter.doFilter(PageBuilderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.jira.web.filters.CommittedResponseHtmlErrorRecoveryFilter.doFilter(CommittedResponseHtmlErrorRecoveryFilter.java:55)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:39)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.troubleshooting.thready.filter.AbstractThreadNamingFilter.doFilter(AbstractThreadNamingFilter.java:46)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.prettyurls.filter.PrettyUrlsCombinedMatchDispatcherFilter.doFilter(PrettyUrlsCombinedMatchDispatcherFilter.java:56)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:55)
at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:43)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.jira.security.xsrf.XsrfTokenAdditionRequestFilter.doFilter(XsrfTokenAdditionRequestFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.jira.web.filters.MauEventFilter.doFilter(MauEventFilter.java:49)
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:66)
at com.atlassian.seraph.filter.SecurityFilter.doFilter(SecurityFilter.java:242)
at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:64)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:94)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:148)
at com.atlassian.jira.web.filters.JiraLoginFilter.doFilter(JiraLoginFilter.java:77)
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:39)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:67)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.bonfire.web.filters.BonfireP3PFilter.doFilter(BonfireP3PFilter.java:42)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.pats.web.filter.TokenBasedAuthenticationFilter.doFilter(TokenBasedAuthenticationFilter.java:83)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.prettyurls.filter.PrettyUrlsCombinedMatchDispatcherFilter.doFilter(PrettyUrlsCombinedMatchDispatcherFilter.java:56)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:55)
at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:43)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.util.profiling.filters.RequestProfilingFilter.doFilter(RequestProfilingFilter.java:62)
at com.atlassian.jira.web.filters.JIRAProfilingFilter.doFilter(JIRAProfilingFilter.java:29)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.jira.web.filters.johnson.JiraJohnson503Filter.doFilter(JiraJohnson503Filter.java:79)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.jira.web.filters.johnson.JiraJohnsonFilter.doFilter(JiraJohnsonFilter.java:72)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:39)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.plugins.authentication.impl.basicauth.filter.DisableBasicAuthFilter.doFilter(DisableBasicAuthFilter.java:70)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.lambda$invokeFilterChain$0(CustomerContextSettingFilter.java:189)
at com.atlassian.servicedesk.internal.api.util.context.ReentrantThreadLocalBasedCodeContext.rteInvoke(ReentrantThreadLocalBasedCodeContext.java:136)
at com.atlassian.servicedesk.internal.api.util.context.ReentrantThreadLocalBasedCodeContext.runOutOfContext(ReentrantThreadLocalBasedCodeContext.java:89)
at com.atlassian.servicedesk.internal.utils.context.CustomerContextServiceImpl.runOutOfCustomerContext(CustomerContextServiceImpl.java:47)
at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.outOfCustomerContext(CustomerContextSettingFilter.java:180)
at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilterImpl(CustomerContextSettingFilter.java:131)
at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilter(CustomerContextSettingFilter.java:120)
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.analytics.client.filter.JiraAnalyticsFilter.doFilter(JiraAnalyticsFilter.java:30)
at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:33)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.troubleshooting.thready.filter.AbstractThreadNamingFilter.doFilter(AbstractThreadNamingFilter.java:46)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57)
at com.atlassian.prettyurls.filter.PrettyUrlsCombinedMatchDispatcherFilter.doFilter(PrettyUrlsCombinedMatchDispatcherFilter.java:56)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)
at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37)
at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:55)
at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:43)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.jira.web.filters.steps.ChainedFilterStepRunner.doFilter(ChainedFilterStepRunner.java:74)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.core.filters.cache.AbstractCachingFilter.doFilter(AbstractCachingFilter.java:31)
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.core.filters.encoding.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:39)
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
at com.atlassian.jira.web.filters.JiraStaticResourceAwareEncodingFilter.doFilterInternal(JiraStaticResourceAwareEncodingFilter.java:20)
at com.atlassian.jira.web.filters.AbstractStaticResourceAwareFilter.doFilter(AbstractStaticResourceAwareFilter.java:59)
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
at com.atlassian.jira.web.filters.PathMatchingEncodingFilter.doFilter(PathMatchingEncodingFilter.java:41)
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.jira.web.filters.MultipartBoundaryCheckFilter.doFilter(MultipartBoundaryCheckFilter.java:36)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.jira.web.filters.steps.ChainedFilterStepRunner.doFilter(ChainedFilterStepRunner.java:74)
at com.atlassian.jira.web.filters.JiraFirstFilter.doFilter(JiraFirstFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.atlassian.gzipfilter.GzipFilter.doFilterInternal(GzipFilter.java:115)
at com.atlassian.gzipfilter.GzipFilter.doFilter(GzipFilter.java:92)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:543)
at org.apache.catalina.valves.StuckThreadDetectionValve.invoke(StuckThreadDetectionValve.java:206)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:698)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:367)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:639)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:882)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1647)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.atlassian.jira.index.IndexingFailureException: Indexing completed with 1 errors
at com.atlassian.jira.index.AccumulatingResultBuilder$CompositeResult.await(AccumulatingResultBuilder.java:189)
at com.atlassian.jira.issue.index.DefaultIndexManager.obtain(DefaultIndexManager.java:896)
at com.atlassian.jira.issue.index.DefaultIndexManager.await(DefaultIndexManager.java:876)
at com.atlassian.jira.issue.index.DefaultIndexManager.executeWithIndexLock(DefaultIndexManager.java:863)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexIssues(DefaultIndexManager.java:651)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexIssueObjects(DefaultIndexManager.java:504)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndex(DefaultIndexManager.java:573)
at jdk.internal.reflect.GeneratedMethodAccessor4424.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.atlassian.jira.config.component.SwitchingInvocationHandler.invoke(SwitchingInvocationHandler.java:38)
at com.sun.proxy.$Proxy32.reIndex(Unknown Source)
at com.atlassian.jira.event.listeners.search.IssuePropertyEventListener$1.apply(IssuePropertyEventListener.java:48)
at com.atlassian.jira.event.listeners.search.IssuePropertyEventListener$1.apply(IssuePropertyEventListener.java:44)
at io.atlassian.fugue.Effect.accept(Effect.java:43)
at io.atlassian.fugue.Option$Some.forEach(Option.java:468)
at io.atlassian.fugue.Option$Some.foreach(Option.java:464)
at com.atlassian.jira.event.listeners.search.IssuePropertyEventListener.reIndex(IssuePropertyEventListener.java:44)
at com.atlassian.jira.event.listeners.search.IssuePropertyEventListener.onIssuePropertySet(IssuePropertyEventListener.java:35)
at jdk.internal.reflect.GeneratedMethodAccessor8006.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:42)
... 461 more
2022-05-09 17:31:01,846 WARN [index.AccumulatingResultBuilder]: Indexing failed for Issue - '116839'
2022-05-09 17:31:01,846 WARN [index.AccumulatingResultBuilder]: cannot change DocValues type from SORTED to NUMERIC for field "sort_customfield_16808"
2022-05-09 17:31:01,848 ERROR [runner.AbstractScriptListener]: *************************************************************************************
2022-05-09 17:31:01,848 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.jira.event.issue.IssueEvent, file: null
com.atlassian.jira.index.IndexingFailureException: Indexing completed with 1 errors
at com.atlassian.jira.index.AccumulatingResultBuilder$CompositeResult.await(AccumulatingResultBuilder.java:189)
at com.atlassian.jira.issue.index.DefaultIndexManager.obtain(DefaultIndexManager.java:896)
at com.atlassian.jira.issue.index.DefaultIndexManager.await(DefaultIndexManager.java:876)
at com.atlassian.jira.issue.index.DefaultIndexManager.executeWithIndexLock(DefaultIndexManager.java:863)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexIssues(DefaultIndexManager.java:651)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexIssueObjects(DefaultIndexManager.java:504)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndex(DefaultIndexManager.java:573)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndex(DefaultIndexManager.java:545)
at com.atlassian.jira.config.component.SwitchingInvocationHandler.invoke(SwitchingInvocationHandler.java:38)
at com.sun.proxy.$Proxy32.reIndex(Unknown Source)
at com.atlassian.jira.issue.index.IssueIndexManager$reIndex$0.call(Unknown Source)
at Script813$_run_closure3.doCall(Script813.groovy:62)
at Script813.run(Script813.groovy:49)
Start of logs truncated as they exceeded 300 lines.

Here is my script as it exists when these logs are sent:


 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.util.ImportUtils
import com.atlassian.jira.issue.index.IssueIndexingService
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue

def linkType = "Issue in Epic"


def linkMgr = ComponentAccessor.issueLinkManager
def cfManager = ComponentAccessor.customFieldManager
def issueManager = ComponentAccessor.issueManager
def issueIndexingService = ComponentAccessor.getComponent(IssueIndexingService.class)

def issue = event.issue

def currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser

def TSField = cfManager.getCustomFieldObjects(issue)?.find{it.name == "Target start"}
def cfValue = issue.getCustomFieldValue(TSField)
def epicLink = cfManager.getCustomFieldObjectsByName("Epic Link")
def epicName = cfManager.getCustomFieldObjectsByName("Epic Name")

def change = event?.changeLog?.getRelated("ChildChangeItem")?.find{it.field == "Target start"}

log.warn ("change: $change")
if (!change){
return
}

//def linkedIssue = linkMgr.getOutwardLinks(issue.id).findAll{it.issueLinkType.name == linkType}

def linkedIssue = linkMgr.getOutwardLinks(issue.id)

 


if (linkedIssue == null){
log.warn ("NOT LINKED ISSUE")
return
}

if (change != null)
{
log.warn ("Trying to start the each loop")

linkedIssue.each
{

log.warn ("WE'RE IN THE EACH LOOP")

def linkedIssueObj = (MutableIssue) it.destinationObject
log.warn ("linkedissueObj: $linkedIssueObj.key")
log.warn ("link type: $it.issueLinkType.name" )

linkedIssueObj.setCustomFieldValue(TSField, cfValue)

issueManager.updateIssue(currentUser, linkedIssueObj , EventDispatchOption.DO_NOT_DISPATCH, false)

def wasIndexing = ImportUtils.isIndexIssues()
ImportUtils.setIndexIssues(true)
issueIndexingService.reIndex(linkedIssueObj)
ImportUtils.setIndexIssues(wasIndexing)
}
}

Tuncay Senturk Community Leader May 10, 2022

I need the logs actually, to see the link type names for the epic.

2022-05-10 11:52:38,376 WARN [runner.ScriptBindingsManager]: change: [newvalue:2022-03-06, field:Target start, oldstring:03/05/2022, newstring:03/07/2022, id:1292830, fieldtype:custom, oldvalue:2022-03-04, group:974125]
2022-05-10 11:52:38,377 WARN [runner.ScriptBindingsManager]: Trying to start the each loop
2022-05-10 11:52:38,378 WARN [runner.ScriptBindingsManager]: WE'RE IN THE EACH LOOP
2022-05-10 11:52:38,381 WARN [runner.ScriptBindingsManager]: linkedissue: TSTPRT-7
2022-05-10 11:52:38,381 WARN [runner.ScriptBindingsManager]: link type: Blocks
2022-05-10 11:52:38,426 WARN [runner.ScriptBindingsManager]: WE'RE IN THE EACH LOOP
2022-05-10 11:52:38,426 WARN [runner.ScriptBindingsManager]: linkedissue: TSTENG-71
2022-05-10 11:52:38,426 WARN [runner.ScriptBindingsManager]: link type: Epic-Story Link
2022-05-10 11:52:38,471 WARN [runner.ScriptBindingsManager]: WE'RE IN THE EACH LOOP
2022-05-10 11:52:38,472 WARN [runner.ScriptBindingsManager]: linkedissue: TSTENG-8
2022-05-10 11:52:38,472 WARN [runner.ScriptBindingsManager]: link type: Epic-Story Link

@Tuncay Senturk I appreciate your help so much.  Thank you for catching that issue before it bit me!

I believe my script does actually work now that I am checking for the proper link type.  Here is the updated last part of my script, based on the logs I pulled:

 

 

if (linkedIssue == null)
{
log.warn ("NOT LINKED ISSUE")
return
}

if (change != null)
{
log.warn ("Trying to start the each loop")

linkedIssue.each
{

log.warn ("WE'RE IN THE EACH LOOP")

def linkedIssueObj = (MutableIssue) it.destinationObject
log.warn ("linkedissue: $linkedIssueObj.key")
log.warn ("link type: $it.issueLinkType.name" )

if (it.issueLinkType.name == "Epic-Story Link")
{
linkedIssueObj.setCustomFieldValue(TSField, cfValue)

issueManager.updateIssue(currentUser, linkedIssueObj , EventDispatchOption.DO_NOT_DISPATCH, false)
}

def wasIndexing = ImportUtils.isIndexIssues()
ImportUtils.setIndexIssues(true)
issueIndexingService.reIndex(linkedIssueObj)
ImportUtils.setIndexIssues(wasIndexing)
}
Tuncay Senturk Community Leader May 12, 2022

Yeah, that's perfect now.

For example, in your logs there is also a Blocks link to TSTPRT-7 which would also be updated, but if you add this control

if (it.issueLinkType.name == "Epic-Story Link")

only Epic-Story link typed issues will be updated.

Thanks

Like padraik likes this

Suggest an answer

Log in or Sign up to answer
TAGS

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