Originally asked by Yaakov Shamii on 06 October 2019 (original question)
Hi,
Is is possible to sync a JIRA custom field (like labels or text field) to another addon custom field (like insight objects)?
Thanks in advance.
Originally asked by Yaakov Shamii on 06 October 2019 (original question)
Hi,
Is is possible to sync a JIRA custom field (like labels or text field) to another addon custom field (like insight objects)?
Thanks in advance.
Answer by Francis Martens (Exalate) on 07 October 2019
Hi Yaakov,
It is.
I’m actually today at Riada to cooperate on a similar case.
I will provide details in the course of the week.
hi Francis, any update about it?
Hi Yaakov Shamii
I forget about this thread - thanks for the nudge
What I did is pretty straightforward - check the Riada documentation for some examples. For instance the case about ‘Load object by key’
https://documentation.riada.io/insight/latest/load-object-by-key-29324684.html
import com.atlassian.jira.component.ComponentAccessor;
/* The object facade class */
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade");
/* The reference to the object facade which you can use in your code */
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass);
/* Log the Insight object */
log.info("Insight object of key SCH-1: " + objectFacade.loadObjectBean("SCH-1"));
Bottom line - you can just use the Riada API in the scripts.
Let me know if this is sufficient.
Hi Yaakov Shamii !
I work for the consultancy side of Riada (the makers of Insight), if you have any questions about Insight and it´s java API feel free to contact our support: https://support.riada.se/ and the Dev side of Riada will be happy to help you.
Or ping me here and I can have a look (old community)
By the way, have you had a look at the postfunctions of Insight? Maybe they can help you, for example “Create an Insight Object from a Jira Issue.”. If you need more flexibility I believe solution is the way to go.
Hi Anders Lantz, ,
I’m having some issues with updating insight custom field value via the sync rules (altought my code works from scriptrunner script console).
can you please have a look at the ticket I opened?
https://support.idalko.com/servicedesk/customer/portal/8/EASE-3304
Thanks a lot!
Hi!
I don’t have access to the ticket (I work for Riada, not Idalko/exalate), but my guess is a permission problem.
You can try early in your script switching to an Admin user.
def authContext = ComponentAccessor.getJiraAuthenticationContext()
authContext.setLoggedInUser(actingUser)
Hi Anders Lantz, Thanks for answering.
I’m using an administrator (and I also gave it manually permissions to the scheme I need). I can send you the code I use and the logs if it might help.