- Introduction
- About
- Get started
- Migration to Cloud
- Bundled Fields
- Bundled Fields Overview
- Adding Bundled Fields
- Bundled Fields Configuration
- Format and validation
- Using Bundled Fields
- Advanced settings
- Bundled Fields Searcher
- Java API (ScriptRunner)
- Data Sources
- Email notifications
- Bundled Fields v.6.8.x - 6.9.x
- Bundled Fields v.6.7.x
- Dynamic Forms
- Dynamic Forms
- Supported fields
- Visibility
- Request Types visibility
- Fields visibility
- Customer Portal visibility
- Options visibility
- Requirements visibility
- SLAs visibility
- Java API
- Multilevel Structure
- Configuration
- Using a multilevel structure on the Customer Portal
- User Synchronization
- Organizations and Groups Synchronization
- Issue View
- Issue View
- Add user's IP address post function
- Restart SLA post function
- Update SLA to date post function
- Customer Portal
- Links
- Export list
- Split column
- Request details view
- Additional fields
- Additional options
- Compatibility
- Configuration Manager
Java API: Troubleshooting
Find solutions for most common problems with the Bundled Fields Java API
- Currently we don’t support ScriptRunner’s Behaviours.
- To find available Java API methods and get more information about what’s supported, go the main Java API chapter.
- To see an example of a Bundled Fields’ JSON structure and descriptions of the attributes, go to Examples and definitions.
Cases that throw exceptions
Here’s a list of the most common error sources:
- Providing a data type that is not compatible with the configured subfield’s type.
- Exceeding the character limit (255) in a text field (single-line).
- Trying to set a value for the separator (which is a technical field).
- Providing a non-existent option as a value.
- Providing a userKey of a non-existent user.
- Providing a non-existent subfield name.
- Providing a non-existent group index.
- Providing an empty value for a required subfield.
- Providing a value that is not compatible with the defined formatting, regular expression, or value mask.
- Trying to exceed the configured number of groups for an issue.
- Trying to create a new group without a required subfield.
- Trying to perform an operation on a Bundled Field that hasn’t been configured (no configuration of such field has ever been saved).
- Error during form validation while trying to update the issue (the possible reason may be a globally required field that hasn’t been filled).
GroovyCastException
You may encounter the following exception while using both Dynamic Forms for Jira and Extension for Jira Service Management in your Jira instance:
2021-05-31 08:57:18,127 ERROR [common.UserScriptEndpoint]: Script console script failed:
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.deviniti.plugins.bundledfields.api.issue.BundledFieldImpl@67c66bcf' with class 'com.deviniti.plugins.bundledfields.api.issue.BundledFieldImpl' to class 'com.deviniti.plugins.bundledfields.api.issue.BundledField'
at Script69.run(Script69.groovy:39)
Problem description
The problem comes from the fact that in a Groovy script, you can only import a class definition from one source at a time (for example, the BundledField class, as in the case below). Such a class definition is cached via the Groovy Script Engine. Then it is used in the context of the Bundled Fields component in all scripts - for both Dynamic Forms and Extension.
Therefore, the GroovyCastException will occur every time a Groovy script uses a Bundled Fields’ class definition from the other app.
Solution
You can solve this problem by using the def type instead of a class.
For example, when you get the GroovyCastException generated by such a script:
import com.deviniti.plugins.bundledfields.api.issue.BundledField
import com.intenso.jira.plugins.bundledfields.api.ExtensionBundledService
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import org.apache.log4j.Logger
import org.apache.log4j.Level
log.setLevel(Level.DEBUG)
String ISSUE_KEY = "BFT2-14";
String EXT_BF_CUSTOM_FIELD_ID = "customfield_10700";
@WithPlugin("com.intenso.jira.plugins.jsd-extender")
@PluginModule
ExtensionBundledService extensionBundledService
log.debug("bundledFieldService: " + extensionBundledService)
BundledField ext_bf = extensionBundledService.getBundledField(ISSUE_KEY, EXT_BF_CUSTOM_FIELD_ID)
log.debug("ext_bf.groups: " + ext_bf.getGroups())
instead of using this class for getting a bundled field:
BundledField ext_bf = extensionBundledService.getBundledField(ISSUE_KEY, EXT_BF_CUSTOM_FIELD_ID)
you can use this script:
def ext_bf = extensionBundledService.getBundledField(ISSUE_KEY, EXT_BF_CUSTOM_FIELD_ID)
How to find a field’s ID
Navigate to Manage apps>Bundled fields>Subfields
- Open developer tools in your browser.
- Go to the Network tab.
- Find Bundled fields, use filter to find it quicker.
- The ID is right above the field’s name.
MissingGroupException: Unable to find group with index: 0
The MissingGroupException: Unable to find group with index: 0
error occurs when a bundled field is empty in the referred issue.
If you can’t find the answer you need in our documentation, raise a support request.
Include as much information as possible to help our support team resolve your issue faster.