2
1
0
We are syncing two Jira Server instances and we have two scenarios here: 1. Portfolio Team fields on both instances 2. Portfolio Team field on one side and a single select list on the other Your support is very much appreciated.
    CommentAdd your comment...

    2 answers

    1.  
      2
      1
      0

      Just found the solution!


      It's


      Outgoing sync
      
      replica.customFields."Team" = issue.customFields."Team"
      
      Incoming sync
      
      if(replica.customFields."Team".value) {
        issue.customFields."Team".value = replica.customFields."Team".value?.description?.title?.toString().replace("\"", "");
      }

      CommentAdd your comment...
    2.  
      1
      0
      -1

      Hello Amr Hamza


      Can you confirm my rewording of your question


      1. Portfolio team bidirectional sync. 
        Blue Jira and Red Jira have both Portfolio
        1. The teams are identical, and changing the team on Blue, will change it on Red
        2. The teams are not identical, and changing the team on Blue to a non existing team on Red will create the team on Red
      2. Portfolio team sync to a select list
        1. The selected blue team is setting the corresponding value in the red select list
        2. New blue teams lead to new entries in red


      1. Amr Hamza

        Hello Francis Martens (iDalko) ,

        Thanks for your reply.

        1. yes bidirectional
          1. exactly like that
          2. if the teams are not identical, it would be greate if we can map them and set a default value to fall back to in case of no match.
        2. also bidirctional (Blue Jira has Portfolio Team field, Red Jira has a single select field)
          1. Red selects an option in the field → Exalate sets the corresponding team in Blue.
          2. Blue selects a team in Portfolio → Exalate sets the corresponding option in the field in Red.
          3. The same idea with the mapping and the default value if no match was found.
      2. Francis Martens (iDalko)

        The first part is simple - in the outgoing sync of the connection add following statement

        replica.customFields.Team = issue.customFields.Team


        When a sync is happening the other side will receive


        replica.customFiels.Team.description.title should contain the name of the team.

        Applying to a select list is straightforward by using the getOption approach.


        We are looking how to set the team field, it needs to go through the Portfolio/Advanced Roadmap api.
        But this approach should already cover part 2 of the question

      3. Amr Hamza

        Thanks Francis Martens (iDalko) .

        Agreed. I suppose the obstacle here is how to set the Portfolio Team field in the incoming sync rules.

      4. Amr Hamza

        Hi Francis Martens (iDalko).


        I hope you're well. Just wanted to check, if there is any progress here.

        Thanks.


        Cheers,

        Amr

      5. Amr Hamza

        Hello Francis Martens (iDalko),


        Are there any updates on this question?

        Thanks.


        Cheers,

        Amr

      6. Berry Kersten

        hi Francis Martens (iDalko), I have an almost similar use case, except I just want to show the Team Name on the remote side.

        I have created a new custom field (single text line) Team, and now it shows {"id":1,"description":{"title":"Team A","avatarUrl":{},"shareable":true}}


        So, I suppose I have to trim this so that only Team A will be shown. Any idea how to do this kind of trimming? Thanks.

      7. Francis Martens (iDalko)

        Can you try


        replica.customFields.Team = issue.customFields.Team?.description?.title

        And let us know

      8. Berry Kersten

        Thanks.

        In that case, I'm getting an Cannot get property 'value' on null object

        Outgoing sync: 

        replica.customFields.Team = issue.customFields.Team?.description?.title


        Incoming sync: 

        issue.customFields."Team".value = replica.customFields."Team".value

        In remote issues I see:
        Team (11001): {"id":3,"description":{"title":"Team IDE (C)","avatarUrl":{},"shareable":true}}

      9. Francis Martens (iDalko)

        Berry


        Ah - I made a typo - better would be

        replica.customKeys.Teamtitle = issue.customFields.Team?.description?.title

        and on the incoming ...

        issue.customFields."Team".value = replica.customKeys.Teamtitle
      10. Berry Kersten

        Hmm, in that case no information is being synced: in remote issues there's no Custom Keys Teamtitle present.

        It looks like it does not get the exact data within {"id":3,"description":{"title":"Team IDE (C)","avatarUrl":{},"shareable":true}}


      11. Francis Martens (iDalko)

        Can you check what the value is of issue.customFields.Team?.description?.title by adding


        throw new Exception("Title = ${issue.customFields.Team?.description?.title}")

        in the outgoing sync.  It should clarify if you get some information out of that customfield




      12. Berry Kersten

        Sure, then I'm getting com.exalate.api.exception.script.ChangeProcessorException: Script error for issue RI-5024. Details: No such property: title for class: java.lang.String. 

      13. Francis Martens (iDalko)

        (tongue)
        You will have to do some investigations. 
        Can you try 

        throw new Exception("Title = ${issue.customFields.Team.value?.description?.title}")

        ...

      14. Berry Kersten

        Francis Martens (iDalko) Sure, in that case it returns: Details: Title = null.

      15. Francis Martens (iDalko)

        In an earlier comment you indicated



        I have created a new custom field (single text line) Team, and now it shows {"id":1,"description":{"title":"Team A","avatarUrl":{},"shareable":true}}


        Where did you fetch this value?


      CommentAdd your comment...