few steps:
1) get the customfield id (you can check by going to the fields -> click on the custom field), the id is part of the URL (at least in JIRA 4.4)
2) For the code:
a) find the parent ticket (newIssue)
b) find the value by
def requestorFieldName = "customfield_XXXXX" ComponentManager componentManager = ComponentManager.getInstance() CustomFieldManager customFieldManager = componentManager.getCustomFieldManager() //get Requestor Name CustomField field = customFieldManager.getCustomFieldObject(fieldName) requestorName = newissue.getCustomFieldValue(field)
c) and you can set the current issue with issue.setCustomFiedl (I think - best to look for JIRA API documentation)
Again this is based off JIRA 4.4, so you might need to double check the API documentation for whichever version you are using
Hope this helps!
Eva,
One of the date custom fields is causing a null pointer exception.
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:1095)
at com.atlassian.jira.issue.IssueImpl.getCustomFieldValue(IssueImpl.java:943)
at com.atlassian.jira.issue.IssueImpl.setCustomFieldValue(IssueImpl.java:952)
at com.atlassian.jira.issue.MutableIssue$setCustomFieldValue.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:120)
at Script22.addSubTask(Script22.groovy:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can you paste the code here? It's hard to troubleshoot without seeing the full code...?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Eva,
One of the date custom fields is causing a null pointer exception.
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:1095)
at com.atlassian.jira.issue.IssueImpl.getCustomFieldValue(IssueImpl.java:943)
at com.atlassian.jira.issue.IssueImpl.setCustomFieldValue(IssueImpl.java:952)
at com.atlassian.jira.issue.MutableIssue$setCustomFieldValue.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:120)
at Script22.addSubTask(Script22.groovy:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1054)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:884)
at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:149)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl$2.invokeMethod(GroovyScriptEngineImpl.java:299)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145)
at Script22.run(Script22.groovy:449)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:315)
Do you have a clue on what this error is about?
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.