1
0
-1
  • In JIRA and Azure DevOps works two different teams.Some of the users are members of both teams, but there are users who are members only of the JIRA team or only of the DevOps team.
  • If there exists a possibility that in JIRA in field Assignee, we have user AAA, who doesn’t exist in DevOps, and during synch in DevOps appears default user BBB.
  • Now we have in script:


def defaultUser = nodeHelper.getUserByEmail(BBB@ebicom.pl)
workItem.assignee = nodeHelper.getUserByEmail(replica.assignee?.email,"AXPO") ?: defaultUser

  • But it work only if in JIRA the field assignee is empty. If there is any user who doesn’t exist in DevOps we have ERROR in synch.
    CommentAdd your comment...

    1 answer

    1.  
      2
      1
      0

      Hi Riddhi,


      Here is the snippet you need:


      def defaultUser = nodeHelper.getUserByEmail("DEFAULT_USER_EMAIL","PROJECT_NAME")
      if (replica.assignee?.email)
      	workItem.assignee = nodeHelper.getUserByEmail(replica.assignee?.email,"PROJECT_NAME") ?: defaultUser
      else
      	workItem.assignee = defaultUser


      Please replace the placeholders in the code with actual values. Here is a short test of the code snippet:


      Please mark the answer as accepted if it solves the issue. 


      Thanks

      Majid

        CommentAdd your comment...