Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

The roadmap child level issues on my Sotware Project take the start and end date of the sprint.

Samuel Rodriguez
March 23, 2023

I would like to organize the child-level issues with their own dates. 

 

As you see below, the first schedule is the epic (this one I can move to a different date than the sprint)

 

The second one is scheduled to start on the 24 and end on the 31, but the roadmap takes the date of the sprint. 

 

How can I have the dates of the child-level issues free from the dates of the sprint (within the sprint they belong of course)?

Screenshot 2023-03-23 at 6.37.27 AM.png

2 answers

1 accepted

0 votes
Answer accepted
Kevin Lynch
March 26, 2013

okay, found the answer in the response to https://answers.atlassian.com/questions/70050/why-do-i-get-a-null-pointer-exception-when-try-to-execute-a-post-function

The field that you want to take with you from the original issue is not also available to the cloned issue/project, the value will be null. You must make the fields available to both projects and issues of the original and clone issue. You DO NOT have to place the field on any screens.

Therefore, the following worked just fine, and the values where passed to the cloned ticket and placed (overwrote) the Descriptions field.

issue.summary = issue.summary + ' (separation ticket from HR)'
issue.description = 'Reports To=' + cfValues['Reports To'] + '\nStart Date=' + cfValues['Start Date']
issue.assigneeId = 'sysadmin'

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 16, 2013

What context is this... some kind of post-function?

What happens if the user has entered a description, do you want to just overwrite it?

Kevin Lynch
March 17, 2013

Yes, it is a post-function and yes, I want the description over written with the Reports To and Start Date information.

Thanks

Kevin Lynch
March 19, 2013

I also tried the below, but am getting:

javax.script.ScriptException: javax.script.ScriptException: java.lang.NullPointerException

import com.atlassian.jira.ComponentManager
 
def componentManager = ComponentManager.instance
def customFieldManager = componentManager.getCustomFieldManager()
 
def rt = customFieldManager.getCustomFieldObjectByName('Reports To')
def sd = customFieldManager.getCustomFieldObjectByName('Start Date')

issue.description = 'Report To=' + issue.getCustomFieldValue(rt) +'\nStart Date=' + issue.getCustomFieldValue(sd)

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 19, 2013

Add some logging so you can see what exactly is null... could be one of the custom fields for instance/

Kevin Lynch
March 22, 2013

Sorry, what package name should I log for?

Kevin Lynch
March 24, 2013

Which package should I add to logging? thanks

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 25, 2013

You can just add some log.warn() statements. You will add the logging statements to your code, rather than turn logging on from some other package.

Kevin Lynch
March 26, 2013

Log Continued...

Caused by: java.lang.NullPointerException
at com.atlassian.jira.issue.customfields.impl.DateCFType.getDefaultValue(DateCFType.java:128)
at com.atlassian.jira.issue.customfields.impl.DateCFType.getDefaultValue(DateCFType.java:51)
at com.atlassian.jira.issue.fields.CustomFieldImpl.getDefaultValue(CustomFieldImpl.java:1124)
at com.atlassian.jira.issue.IssueImpl.getCustomFieldValue(IssueImpl.java:942)
at com.atlassian.jira.issue.Issue$getCustomFieldValue.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at Script25.run(Script25.groovy:10)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:315)
... 207 more

Kevin Lynch
March 26, 2013

Okay, I've moved a little farther. But still can't figure out how to pull the original issue value. I ran the below in Script Runner and it pulls the values correctly from the Issue.

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField

CustomFieldManager customFieldManager = ComponentManager.getInstance().getCustomFieldManager()
issueOld = ComponentManager.getInstance().getIssueManager().getIssueObject("HR-823")
def cf = customFieldManager.getCustomFieldObject(10434)

def sd = issueOld.getCustomFieldValue(cf)

System.out.println(sd)

I modified my post function so I could hopefully see the output of the value in the logs, but it still has an problem.

import com.atlassian.jira.ComponentManager
  
def componentManager = ComponentManager.instance
def customFieldManager = componentManager.getCustomFieldManager()
  
def cf1 = customFieldManager.getCustomFieldObject(10436)
def cf2 = customFieldManager.getCustomFieldObject(10434)

rt = issue.getCustomFieldValue(cf1)
sd = issue.getCustomFieldValue(cf2)

issue.summary = issue.summary + ' (separation ticket from HR)'
System.out.println('Reports To=' + rt)
System.out.println('Start Date=' + sd)
issue.assigneeId = 'sysadmin'

My next comment will contain the log data

Kevin Lynch
March 26, 2013

Part 1 of log

2013-03-26 11:40:13,699 http-apr-8080-exec-20 ERROR klynch 700x6222x1 1oxtgcn 10.1.74.16 /secure/CommentAssignIssue.jspa [onresolve.jira.groovy.GroovyFunctionPlugin] Error executing post-function
javax.script.ScriptException: javax.script.ScriptException: java.lang.NullPointerException
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:117)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
at javax.script.ScriptEngine$eval.call(Unknown Source)
at com.onresolve.jira.groovy.canned.utils.ConditionUtils.doAdditional(ConditionUtils.groovy:102)
at sun.reflect.GeneratedMethodAccessor2147.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1770)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: javax.script.ScriptException: java.lang.NullPointerException
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:318)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:111)
... 206 more

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 26, 2013

Your println statements have gone to a different log... can you change the println to log.warn, and look for that output in the log.

Kevin Lynch
March 26, 2013

I put the following, but catalina.out shows the same thing as before.

import com.atlassian.jira.ComponentManager
  
def componentManager = ComponentManager.instance
def customFieldManager = componentManager.getCustomFieldManager()
  
def cf1 = customFieldManager.getCustomFieldObject(10436)
def cf2 = customFieldManager.getCustomFieldObject(10434)

rt = issue.getCustomFieldValue(cf1)
sd = issue.getCustomFieldValue(cf2)

issue.summary = issue.summary + ' (separation ticket from HR)'
log.warn('Reports To=' + rt)
log.warn('Start Date=' + sd)
issue.assigneeId = 'sysadmin'

Kevin Lynch
March 26, 2013

changed to:

import com.atlassian.jira.ComponentManager
   
def componentManager = ComponentManager.instance
def customFieldManager = componentManager.getCustomFieldManager()
   
def cf1 = customFieldManager.getCustomFieldObject(10436)
def cf2 = customFieldManager.getCustomFieldObject(10434)
 
rt = issue.getCustomFieldValue(cf1)
sd = issue.getCustomFieldValue(cf2)
 
issue.summary = issue.summary + ' (separation ticket from HR)'
log.warn(rt)
log.warn(sd)
issue.assigneeId = 'sysadmin'

Kevin Lynch
March 26, 2013

The log is 227 lines and 21410 characters, so I can't post it. But it's the same output as what I posted in the two posts above.

Suggest an answer

Log in or Sign up to answer