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"])
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?
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?
thank you for checking this out.
My script is looking for an issue of type "Managed Release"
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.
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG