Hello,
we have a scripted field on a view screen that calculates the centralized release version based on the version entered in the issue.
def issueLinkManager = ComponentAccessor.getIssueLinkManager() def searchProviderFactory = ComponentAccessor.getComponent(SearchProviderFactory) def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser() def searchProvider = ComponentAccessor.getComponent(SearchProvider) def issueManager = ComponentAccessor.getIssueManager() def customFieldManager = ComponentAccessor.getCustomFieldManager(); CustomField managedRelease = customFieldManager.getCustomFieldObject("customfield_11801"); def builder = JqlQueryBuilder.newBuilder().where().defaultOr() def clauseBuilder = JqlQueryBuilder.newClauseBuilder().defaultAnd() clauseBuilder.project(issue.getProjectObject().getId()); if(issue.getFixVersions() == null || issue.getFixVersions().size() < 1) return ""; clauseBuilder.fixVersion(issue.getFixVersions().iterator().next().getName()); clauseBuilder.issueType("10402"); builder.addClause(clauseBuilder.buildClause()) def query = builder.buildQuery() def result = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter()); if(result.getIssues().size() > 0) return result.getIssues().get(0).getCustomFieldValue(managedRelease); else return "";
the script works fine, it executes without errors. However when creating a new issue, Jira 7.3.5 (previously 7.1.9 worked fine) throws the following exception
com.atlassian.plugins.rest.common.json.JsonMarshallingException: org.codehaus.jackson.map.JsonMappingException: No serializer found for class com.atlassian.jira.issue.customfields.option.LazyLoadedOption and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: com.atlassian.jira.quickedit.rest.api.field.QuickEditFields["createdIssueDetails"]->com.atlassian.jira.rest.v2.issue.IssueBean["fields"]->java.util.HashMap["customfield_12601"])
at com.atlassian.plugins.rest.common.json.DefaultJaxbJsonMarshaller.marshal(DefaultJaxbJsonMarshaller.java:57)
the mentioned custom field is the ID of the scripted field above.
We have no searcher configured as it is only a display field. Is there any way to avoid the exception?
Hi Stefan,
I have been looking into your issue, and I have tried your script on Jira version 7.3.5 and it seems to run without porblems. I do have some questions that might help get to the bottom of your issue.
You mentioned "the mentioned custom field is the ID of the scripted field above.", however if I set the custom field ID to that of the scripted field (CustomField managedRelease = customFieldManager.getCustomFieldObject("customfield_11801")), I get a StackOverflow error because essentially the script is retrieving its own value. It works for me when I reference a different (text field) custom value on that line instead. Can you maybe provide me with a screenshots of your custom fields, or confirm which field this ID should be?
Thanks,
Steve
Hi Stephen,
thank you for checking this out.
My script is looking for an issue of type "Managed Release"
clauseBuilder.issueType("10402");
which carries a custom field called managed release version (11801)
The scripted field 12601 is essentially a script that displays the custom field value in all issue that carry a fixversion that corresponds to the fixversion of the Managed Release issue type.
best regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stefan,
Try return a string instead, so in your return line
return result.getIssues().get(0).getCustomFieldValue(managedRelease)?.toString()
Let us know if this fix the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thanos,
I have stumbled on similar bug and result.toString() solved problem.
Thanks, Jozef
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Jozef, thanks for letting us know :)
cheers, Thanos
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.