Set default Insight object

Originally asked by Samuel Bartolome on 03 September 2020 (original question)


Hi there,
I would like to set a default value for an Insight Object.
Any help will be appreciated.
ThanksSource: Jira Server/Datacenter (old community)


Answer by Francis Martens (Exalate) on 04 September 2020

Hi Samuel Bartolome

We are preparing a blog topic on insight synchronisation - can you elaborate on the use case. What is the default value


Comments:

Samuel Bartolome commented on 04 September 2020

Hi Francis Martens (iDalko),

We have an extensive Insight Object with all different pieces of software available so users can select the appropriate one (ie. Adobe Reader, MS Word and so on).

We would like that one of those pieces of software is set as default when we exalate

I hope this helps better to understand the enquiry.

Thanks

Samuel Bartolome commented on 08 September 2020

Any suggestions that can help us?

Patrick Wittke commented on 09 September 2020

Hi Francis Martens (Exalate),

we are trying to set an Insight Object picker with one specified value that we know by ID or name.

We can read the object, but it is not setting the field value and only returns NULL:

/* Get Insight IQL Facade from plugin accessor */
Class iqlFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.IQLFacade"); 
def iqlFacade = ComponentAccessor.getOSGiComponentInstanceOfType(iqlFacadeClass);
def insightObject = iqlFacade.findObjectsByIQLAndSchema(1, "Key = MYKEY-124");

issue.customFields["Affected Components"].value = insightObject

Neither as Object, nor as the value returned via REST the field works and only stores null each time.

Jira’s REST API returns the following value for the field:

"customfield_10710": [
"MY TITLE (MYKEY-124)"
],

Thanks,
Patrick
CC: Samuel Bartolome

Ariel Mears commented on 25 March 2021

Was there an answer on this? I’m trying to do the same but when I use the iqlFacade, my object returns NULL even though I can run the same code in a groovy console which returns the object.