1
0
-1

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.

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      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.

      1. Yaakov Shamii

          hi Francis, any update about it?

      2. user-3fd1a

        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


        • Ensure that the insight is installed
        • Copy the code and insert in the script at the appropriate place - you will have to massage it a bit


        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.


      3. Anders Lantz

        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 (smile)


        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.

      4. Yaakov Shamii

        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!

      5. Anders Lantz

        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)

      6. Yaakov Shamii

        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.

      CommentAdd your comment...