Scripted field isn't correct after export

AlekseyStrelnik July 16, 2018

Scripted field in export.xlsx (from Gantt in BigPicture) has the follow value :

com.softwareplant.util.datatype.field.FieldHtmlElements@3218c8f5

1 answer

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 17, 2018

Your script is dumping out the issue type object as the output, rather than the actual value.

AlekseyStrelnik July 17, 2018

How can I fix it? Here is my script:

import com.atlassian.jira.issue.comments.Comment
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.component.ComponentAccessor

CommentManager commentManager = ComponentAccessor.getCommentManager()
List<Comment> comments = commentManager.getComments(issue)

List<String> out = []

comments.each {
out << String.format(it.body)
}

out = out.reverse()

java.lang.String res = java.lang.String.join("<br>",out)

return res

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 17, 2018

I don't see how that script would be getting a field object from another add-on, unless someone genuinely has pasted a field object definition into a comment.

What does the field show in the issue navigator?  And on the actual issue?

AlekseyStrelnik July 17, 2018

This scripted field was made using ScripRunner Add-on. This field (named "History of comments") is displayed correctly in the navigator: value of field = concatenation of all comments. The export from navigator is correct too.  

I have problem with export from Gantt view page (BigPicture Add-on).

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 17, 2018

Ah, I see, it's not that the field is wrong in the exports, it's wrong in BigPicture.

My guess is that the BigPicture does not understand what a Scriptrunner scripted field is, and it is trying to do some form of conversion or formatting on it (the issue navigator and issue view do not format or convert.  Because it doesn't know what the returned object is, it cannot handle it, and is just outputting the object instead of the content.

There's a couple of things more to look at to confirm my guesses. 

First, what is the "template" for your scripted field?  I would expect BigPicture to be ok if it is a text type, but if it is one of the more "clever" ones, maybe not.

Second, a look at the log file for the time that you did the export might be useful, as it might give us the full conversion error so we can see what BigPicture is trying to do with the field and where it is going wrong.

AlekseyStrelnik July 17, 2018

There is my scripted field:image.png

AlekseyStrelnik July 17, 2018
at Script112.run(Script112.groovy:10)
at Script112$_run_closure1.doCall(Script112.groovy:14)
java.util.UnknownFormatConversionException: Conversion = ','
Script field failed on issue: NAK-446, field: История комментариев
2018-07-17 16:32:58,335 http-nio-8080-exec-188 ERROR gavrilov 992x17580x1 yof1gb 95.59.202.53,0:0:0:0:0:0:0:1 /rest/softwareplant-bigpicture/1.0/ppm/structure/gantt/7/500 [c.o.scriptrunner.customfield.GroovyCustomField] *************************************************************************************
2018-07-17 16:27:16,441 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteDirectory] INCREMENTAL synchronisation complete for directory [ 10002 ] in [ 70ms ]
2018-07-17 16:27:16,441 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteChangeOperations] removed [ 0 ] groups successfully in [ 0ms ]
2018-07-17 16:27:16,441 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteChangeOperations] removing [ 0 ] groups
2018-07-17 16:27:16,440 Caesium-1-1 INFO ServiceRunner [c.a.c.d.ldap.cache.UsnChangedCacheRefresher] scanned and compared [ 0 ] groups for delete in DB cache in [ 0ms ]
2018-07-17 16:27:16,440 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DirectoryCacheImplUsingChangeOperations] synchronized [ 0 ] groups in [ 8ms ]
2018-07-17 16:27:16,439 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteChangeOperations] scanned and compared [ 0 ] groups for update in DB cache in [ 7ms ]
2018-07-17 16:27:16,432 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DirectoryCacheImplUsingChangeOperations] scanning [ 0 ] groups to add or update
2018-07-17 16:27:16,432 Caesium-1-1 INFO ServiceRunner [c.a.c.d.ldap.cache.UsnChangedCacheRefresher] found [ 0 ] changed remote groups in [ 9ms ]
2018-07-17 16:27:16,423 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DirectoryCacheImplUsingChangeOperations] synchronised [ 0 ] users in [ 2ms ]
2018-07-17 16:27:16,423 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DirectoryCacheImplUsingChangeOperations] scanned and compared [ 0 ] users for update in DB cache in [ 2ms ]
2018-07-17 16:27:16,422 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteChangeOperations] scanning [ 0 ] users to add or update
2018-07-17 16:27:16,421 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DirectoryCacheImplUsingChangeOperations] synchronised [ 0 ] users in [ 3ms ]
2018-07-17 16:27:16,421 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DirectoryCacheImplUsingChangeOperations] scanned and compared [ 0 ] users for update in DB cache in [ 3ms ]
2018-07-17 16:27:16,420 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteChangeOperations] scanning [ 0 ] users to add or update
2018-07-17 16:27:16,418 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteChangeOperations] deleted [ 1 ] users in [ 19ms ]
2018-07-17 16:27:16,399 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteChangeOperations] deleting [ 1 ] users
2018-07-17 16:27:16,397 Caesium-1-1 INFO ServiceRunner [c.a.c.d.ldap.cache.UsnChangedCacheRefresher] scanned and compared [ 1 ] users to delete, [ 0 ] users to add, [ 0 ] users to update in DB cache in [ 17ms ]
2018-07-17 16:27:16,371 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteDirectory] Attempting INCREMENTAL synchronisation for directory [ 10002 ]
2018-07-17 16:27:16,371 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteDirectory] INCREMENTAL synchronisation for directory [ 10002 ] starting
... 264 more
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.UNIXProcess.forkAndExec(Native Method)
Caused by: java.io.IOException: error=2, Нет такого файла или каталога
at java.lang.Thread.run(Thread.java:745)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
... 23 filtered
at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
... 26 filtered
at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
... 4 filtered
at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
... 10 filtered
at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
... 19 filtered
at com.atlassian.plugins.rest.module.servlet.RestSeraphFilter.doFilter(RestSeraphFilter.java:37)
... 16 filtered
at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:64)
... 1 filtered
at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:66)
... 10 filtered
at com.quisapps.jira.fieldsecurity.filter.FieldSecurityFilter.doFilter(FieldSecurityFilter.java:63)
at com.quisapps.jira.fieldsecurity.filter.FieldSecurityFilter.doFilterInterval(FieldSecurityFilter.java:106)
at com.quisapps.jira.fieldsecurity.filter.FieldSecurityFilter.doFilterChainWithProfiling(FieldSecurityFilter.java:251)
... 46 filtered
at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
... 41 filtered
at com.atlassian.plugins.rest.module.RestDelegatingServletFilter.doFilter(RestDelegatingServletFilter.java:68)
... 1 filtered
at com.atlassian.plugins.rest.module.RestDelegatingServletFilter$JerseyOsgiServletContainer.doFilter(RestDelegatingServletFilter.java:154)
... 19 filtered
at java.lang.reflect.Method.invoke(Method.java:498)
... 2 filtered
at com.softwareplant.ppm.gantt.rest.StructureExportResourceServer.export(StructureExportResourceServer.java:57)
at com.sun.proxy.$Proxy4187.export(Unknown Source)
at com.softwareplant.util.security.domain.SecurityMethodInterceptor.invoke(SecurityMethodInterceptor.java:51)
at java.lang.reflect.Method.invoke(Method.java:498)
... 2 filtered
at com.softwareplant.ppm.gantt.rest.StructureExportDelegateImpl.export(StructureExportDelegateImpl.java:44)
at com.softwareplant.ppm.exportapi.ExportRequestDelegate.generateExport(ExportRequestDelegate.java:44)
at com.softwareplant.ppm.exportapi.ExportRequestDelegate.extractAndValidate(ExportRequestDelegate.java:67)
at com.sun.proxy.$Proxy4220.getAvailableTemplates(Unknown Source)
at com.softwareplant.util.lang.proxy.CrossClassLoaderInvocationHandler.invoke(CrossClassLoaderInvocationHandler.java:26)
at java.lang.reflect.Method.invoke(Method.java:498)
... 2 filtered
at com.sun.proxy.$Proxy3676.getAvailableTemplates(Unknown Source)
at com.softwareplant.system.core.endpoint.SystemEndPointInterceptor.invoke(SystemEndPointInterceptor.java:22)
at java.lang.reflect.Method.invoke(Method.java:498)
... 2 filtered
at com.softwareplant.ppm.export.structure.StructureExportEndPoint.getAvailableTemplates(StructureExportEndPoint.java:35)
at com.softwareplant.ppm.export.structure.StructureExportServiceImpl.getAvailableTemplates(StructureExportServiceImpl.java:95)
at com.softwareplant.ppm.export.structure.adapter.ImageStructureExportAdapter.getAvailableTemplates(ImageStructureExportAdapter.java:71)
at com.softwareplant.ppm.export.image.headlesschrome.HeadlessChromeImageExportService.isExportAvailable(HeadlessChromeImageExportService.java:109)
at com.softwareplant.ppm.export.image.shellexecutor.UnixShellCommandExecutor.isCommandExecutionSuccessful(UnixShellCommandExecutor.java:9)
at com.softwareplant.ppm.export.image.shellexecutor.AbstractShellCommandExecutor.isCommandExecutionSuccessful(AbstractShellCommandExecutor.java:90)
at java.lang.Runtime.exec(Runtime.java:347)
at java.lang.Runtime.exec(Runtime.java:450)
at java.lang.Runtime.exec(Runtime.java:620)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
java.io.IOException: Cannot run program "node": error=2, Нет такого файла или каталога
2018-07-17 16:21:53,304 http-nio-8080-exec-124 ERROR strelnik 981x17285x1 uoxkj6 172.16.11.103,0:0:0:0:0:0:0:1 /rest/softwareplant-bigpicture/1.0/ppm/gantt/program/7/structure/export/export [c.s.p.e.image.shellexecutor.AbstractShellCommandExecutor] Command com.softwareplant.ppm.export.image.shellexecutor.ShellCommand@6a21dcef[executionCommand=node -e "require('puppeteer')"] failed
AlekseyStrelnik July 17, 2018
at Script112.run(Script112.groovy:10)
at Script112$_run_closure1.doCall(Script112.groovy:14)
java.util.UnknownFormatConversionException: Conversion = ','
Script field failed on issue: NAK-446, field: История комментариев
2018-07-17 16:32:58,335 http-nio-8080-exec-188 ERROR gavrilov 992x17580x1 yof1gb 95.59.202.53,0:0:0:0:0:0:0:1 /rest/softwareplant-bigpicture/1.0/ppm/structure/gantt/7/500 [c.o.scriptrunner.customfield.GroovyCustomField] *************************************************************************************
2018-07-17 16:27:16,441 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteDirectory] INCREMENTAL synchronisation complete for directory [ 10002 ] in [ 70ms ]
2018-07-17 16:27:16,441 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteChangeOperations] removed [ 0 ] groups successfully in [ 0ms ]
2018-07-17 16:27:16,441 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteChangeOperations] removing [ 0 ] groups
2018-07-17 16:27:16,440 Caesium-1-1 INFO ServiceRunner [c.a.c.d.ldap.cache.UsnChangedCacheRefresher] scanned and compared [ 0 ] groups for delete in DB cache in [ 0ms ]
2018-07-17 16:27:16,440 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DirectoryCacheImplUsingChangeOperations] synchronized [ 0 ] groups in [ 8ms ]
2018-07-17 16:27:16,439 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteChangeOperations] scanned and compared [ 0 ] groups for update in DB cache in [ 7ms ]
2018-07-17 16:27:16,432 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DirectoryCacheImplUsingChangeOperations] scanning [ 0 ] groups to add or update
2018-07-17 16:27:16,432 Caesium-1-1 INFO ServiceRunner [c.a.c.d.ldap.cache.UsnChangedCacheRefresher] found [ 0 ] changed remote groups in [ 9ms ]
2018-07-17 16:27:16,423 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DirectoryCacheImplUsingChangeOperations] synchronised [ 0 ] users in [ 2ms ]
2018-07-17 16:27:16,423 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DirectoryCacheImplUsingChangeOperations] scanned and compared [ 0 ] users for update in DB cache in [ 2ms ]
2018-07-17 16:27:16,422 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteChangeOperations] scanning [ 0 ] users to add or update
2018-07-17 16:27:16,421 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DirectoryCacheImplUsingChangeOperations] synchronised [ 0 ] users in [ 3ms ]
2018-07-17 16:27:16,421 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DirectoryCacheImplUsingChangeOperations] scanned and compared [ 0 ] users for update in DB cache in [ 3ms ]
2018-07-17 16:27:16,420 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteChangeOperations] scanning [ 0 ] users to add or update
2018-07-17 16:27:16,418 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteChangeOperations] deleted [ 1 ] users in [ 19ms ]
2018-07-17 16:27:16,399 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteChangeOperations] deleting [ 1 ] users
2018-07-17 16:27:16,397 Caesium-1-1 INFO ServiceRunner [c.a.c.d.ldap.cache.UsnChangedCacheRefresher] scanned and compared [ 1 ] users to delete, [ 0 ] users to add, [ 0 ] users to update in DB cache in [ 17ms ]
2018-07-17 16:27:16,371 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteDirectory] Attempting INCREMENTAL synchronisation for directory [ 10002 ]
2018-07-17 16:27:16,371 Caesium-1-1 INFO ServiceRunner [c.a.crowd.directory.DbCachingRemoteDirectory] INCREMENTAL synchronisation for directory [ 10002 ] starting
... 264 more
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.UNIXProcess.forkAndExec(Native Method)
Caused by: java.io.IOException: error=2, Нет такого файла или каталога
at java.lang.Thread.run(Thread.java:745)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
... 23 filtered
at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
... 26 filtered
at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
... 4 filtered
at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
... 10 filtered
at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
... 19 filtered
at com.atlassian.plugins.rest.module.servlet.RestSeraphFilter.doFilter(RestSeraphFilter.java:37)
... 16 filtered
at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:64)
... 1 filtered
at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:66)
... 10 filtered
at com.quisapps.jira.fieldsecurity.filter.FieldSecurityFilter.doFilter(FieldSecurityFilter.java:63)
at com.quisapps.jira.fieldsecurity.filter.FieldSecurityFilter.doFilterInterval(FieldSecurityFilter.java:106)
at com.quisapps.jira.fieldsecurity.filter.FieldSecurityFilter.doFilterChainWithProfiling(FieldSecurityFilter.java:251)
... 46 filtered
at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
... 41 filtered
at com.atlassian.plugins.rest.module.RestDelegatingServletFilter.doFilter(RestDelegatingServletFilter.java:68)
... 1 filtered
at com.atlassian.plugins.rest.module.RestDelegatingServletFilter$JerseyOsgiServletContainer.doFilter(RestDelegatingServletFilter.java:154)
... 19 filtered
at java.lang.reflect.Method.invoke(Method.java:498)
... 2 filtered
at com.softwareplant.ppm.gantt.rest.StructureExportResourceServer.export(StructureExportResourceServer.java:57)
at com.sun.proxy.$Proxy4187.export(Unknown Source)
at com.softwareplant.util.security.domain.SecurityMethodInterceptor.invoke(SecurityMethodInterceptor.java:51)
at java.lang.reflect.Method.invoke(Method.java:498)
... 2 filtered
at com.softwareplant.ppm.gantt.rest.StructureExportDelegateImpl.export(StructureExportDelegateImpl.java:44)
at com.softwareplant.ppm.exportapi.ExportRequestDelegate.generateExport(ExportRequestDelegate.java:44)
at com.softwareplant.ppm.exportapi.ExportRequestDelegate.extractAndValidate(ExportRequestDelegate.java:67)
at com.sun.proxy.$Proxy4220.getAvailableTemplates(Unknown Source)
at com.softwareplant.util.lang.proxy.CrossClassLoaderInvocationHandler.invoke(CrossClassLoaderInvocationHandler.java:26)
at java.lang.reflect.Method.invoke(Method.java:498)
... 2 filtered
at com.sun.proxy.$Proxy3676.getAvailableTemplates(Unknown Source)
at com.softwareplant.system.core.endpoint.SystemEndPointInterceptor.invoke(SystemEndPointInterceptor.java:22)
at java.lang.reflect.Method.invoke(Method.java:498)
... 2 filtered
at com.softwareplant.ppm.export.structure.StructureExportEndPoint.getAvailableTemplates(StructureExportEndPoint.java:35)
at com.softwareplant.ppm.export.structure.StructureExportServiceImpl.getAvailableTemplates(StructureExportServiceImpl.java:95)
at com.softwareplant.ppm.export.structure.adapter.ImageStructureExportAdapter.getAvailableTemplates(ImageStructureExportAdapter.java:71)
at com.softwareplant.ppm.export.image.headlesschrome.HeadlessChromeImageExportService.isExportAvailable(HeadlessChromeImageExportService.java:109)
at com.softwareplant.ppm.export.image.shellexecutor.UnixShellCommandExecutor.isCommandExecutionSuccessful(UnixShellCommandExecutor.java:9)
at com.softwareplant.ppm.export.image.shellexecutor.AbstractShellCommandExecutor.isCommandExecutionSuccessful(AbstractShellCommandExecutor.java:90)
at java.lang.Runtime.exec(Runtime.java:347)
at java.lang.Runtime.exec(Runtime.java:450)
at java.lang.Runtime.exec(Runtime.java:620)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
java.io.IOException: Cannot run program "node": error=2, Нет такого файла или каталога
2018-07-17 16:21:53,304 http-nio-8080-exec-124 ERROR strelnik 981x17285x1 uoxkj6 172.16.11.103,0:0:0:0:0:0:0:1 /rest/softwareplant-bigpicture/1.0/ppm/gantt/program/7/structure/export/export [c.s.p.e.image.shellexecutor.AbstractShellCommandExecutor] Command com.softwareplant.ppm.export.image.shellexecutor.ShellCommand@6a21dcef[executionCommand=node -e "require('puppeteer')"] failed
AlekseyStrelnik July 17, 2018

One more fact: 

When I use BigTemplate template with two columns (#BT.task.Type and #BT.task.custom.customfield_10636), export file (xslx) has all columns selected for the perspective in gantt configuration.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 17, 2018

Ok, looks like BigPicture simply can't handle text output from scripted fields.

AlekseyStrelnik July 17, 2018

Nic, thank you for help! Do u think it is reall that BigPicture DevelopTeam will fix it in the near future? 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 17, 2018

I do not know, sorry.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events