has someone tried syncing a select list field from Jira cloud to an insight field on Jira On-Premise.
I tried a couple of community posts but none of them work for me unfortunately.
This is the code that I am using
def authContext = ComponentAccessor.getJiraAuthenticationContext();
def currentUser = ComponentAccessor.getUserManager().getUser(“admin”)
authContext.setLoggedInUser(currentUser);
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass(“com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade”);
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass);
def insightObjectName = “InsightField”
def object = objectFacade.loadObjectBean(“IT-4”) //issue.customFields[insightObjectName].value = object
This is how the remote replica looks like for an insight field
“customKeys”: {
“InsightField”: [
“IT-4”
]
}
This is the error i get
Exalate has problems performing an issue update in this Jira. Details: java.lang.String cannot be cast to java.util.Collection
Here I am just trying to hardcode a value and I am even able to get the object value but unable to set the value unfortunately,
Found 2 results for 'sync select list field Jira Cloud to insight field Jira On Premise status:public'
Read topic
Reading:
Search
Found 2 results for 'sync insight custom field to select list cascading Jira Cloud Jira On Premise status:public'
It seems like there might be some confusion around syncing the select list field from Jira Cloud to the insight field on Jira On-Premise. The error you’re encountering, java.lang.String cannot be cast to java.util.Collection, suggests that there may be a mismatch in the data types being used for the field value on your Jira On-Premises instance.
In your use case, you’ll want to ensure that you’re handling the data type conversion correctly. Insight fields typically require a specific object or collection rather than a simple string.
Here’s what you can do:
Insight Object Handling:
Ensure that the object you’re attempting to assign is compatible with the expected data type of the Insight field. Make sure it’s not expecting a collection if you’re passing a single object.
Data Conversion:
Check whether the Insight field can accept a single object and try using Collections.singleton(object) if a collection type is expected.
Documentation Reference:
Unfortunately, I couldn’t find the exact thread to address this specific topic with a working example on the community, but it’s crucial to ensure that the API used in your scripting is consistent with the Java API of Insight.
For further troubleshooting, you might want to look into any updated Exalate documentation regarding custom scripting between different field types.