1
0
-1

A project sync issue to B project, need to create or update issue link in B project issue, in Outgoing or Incoming template the script how to implement it?

  1. Ariel Aguilar

    Have you looked at:

    https://docs.idalko.com/exalate/x/d40rAQ

    Let me know if it helps.

    Kind regards,

    Ariel

  2. Megan Zhou

    We don't seem to have permission to view this document

  3. Serhiy Onyshchenko

    Hello, Megan Zhou 
    Sorry for the docs link, that article seems to be archived. Also, by the looks of it's content it's a bit unreliable as well.

    If if you have local sync (both projects are on the same Jira), you could try adding the following to your incoming sync script:

    if (firstSync) {
        issue.issueLinks += new com.exalate.basic.domain.hubobject.v1.BasicHubIssueLink(
                replica.id as Long,
                "is related to ",
                "Relates",
                com.exalate.basic.domain.hubobject.v1.BasicHubIssueLink.IssueLinkType.ISSUE,
                null
        )
    }


    BTW this snippet also relies on Outgoing sync script doing this:

    replica.id = issue.id



    Please, let me know how it goes,
    Serhiy.

  4. Megan Zhou

    It seems that this method does not workimage2021-10-29_11-35-43.png

  5. Serhiy Onyshchenko

    Let's try this instead then:

    if (firstSync) {
        issue.issueLinks += new com.exalate.basic.domain.hubobject.v1.BasicHubIssueLink(
                replica.id as Long,
                "is related to ",
                "Relates",
                com.exalate.basic.domain.hubobject.v1.BasicHubIssueLink.IssueLinkType.ISSUE,
                null,
                true
        )
    }

    Regards, Serhiy.

  6. Megan Zhou

    Can we add issue link in this way? We want to customize the parent issue, but we were unsuccessful. Do you have any better suggestions?

  7. Megan Zhou

    Hello ,@Serhiy Onyshchenko


    Can you see it for me?


    Thanks

    Megan

  8. Serhiy Onyshchenko

    Hello, Megan Zhou 
    With the outgoing sync script that you have, all the children issues would be linked to the same parent - is it intended?
    Could you elaborate on



     We want to customize the parent issue

    In what way would you like to customize it?

    but we were unsuccessful

    What happened was any link created?

    Regards, Serhiy.


  9. Megan Zhou

    Hello ,@Serhiy Onyshchenko


    My test script is associated with a parent issue, and the parent issue will be distinguished based on the value of a fixed file in the future. But the same parent issue used now has not been added successfully.


    Thanks

    Megan

  10. Serhiy Onyshchenko

    Aha, so no new link is generated overall, right?
    Is this supposed to be the standard sub-task link, and not the issue link from /secure/admin/ViewLinkTypes!default.jspa :

  11. Megan Zhou

    I think it is a issue link  from /secure/admin/ViewLinkTypes!default.jspa


  12. Serhiy Onyshchenko

    BTW, I can see that the incoming script is adding that link only once upon the first sync.
    What are the steps you take to test it?

  13. Megan Zhou

    I created an issue in the tested project and used this script to synchronize to another project. I found that the issue has been synchronized and the issue link was not added successfully.


  14. Serhiy Onyshchenko

    Hey, Megan Zhou , indeed, your config looks just right for this.
    In such case, I'd suggest to try using the Jira API to create the link.
    First - make sure the issue is created by using: Epic.groovy

    Epic.CreateIssue.create(  replica,  issue,  syncRequest,  nodeHelper,  issueBeforeScript,  remoteReplica,  traces,  blobMetadataList) {
     }
    // now the issue is created and issue.id points to the newly created issue


    Second - use the ComponentAccessor.issueLinkManager to create the issue link between the source and the target issues (also found this as an example: https://docs.idalko.com/exalate/x/SQSOAQ).

    Please let me know if you need any further guidance on that
    Regards, Serhiy.

  15. Megan Zhou

    Hi Serhiy Onyshchenko,

    I will try it according to the method you provided, thank you very much for your help。


    Thanks

    Megan

CommentAdd your comment...