1
0
-1

I'm having trouble updating Issue's type via Exalate. The typename updates nicely but it doesn't actually update the type of the issue.



def statusMapping = [

// Jira issue status <-> Zendesk ticket status
"bug" : "Bug",
"feature_request" : "Story",
"task" : "Task",
"technical_issue" : "Task"
]

def TicketTypeName = replica.customFields."Ticket type"?.value?.value
//throw new Exception("Status - ${TicketTypeName}")
def TicketType = statusMapping[TicketTypeName] ?: "Bug"
//throw new Exception("Status - ${TicketType}")
//issue.typeName = nodeHelper.getIssueType(TicketType)?.name ?: "Bug"
issue.typeName = nodeHelper.getIssueType(TicketType)?.name ?: "Bug"
issue.type.name = issue.typeName
throw new Exception("Status - ${issue.type.properties}")



The exception shows the type name updates to Task as it should but the issue itself is still the original type in Jira.



Script error for issue PCO-2613. Details: Status - [class:class com.exalate.basic.domain.hubobject.v1.BasicHubIssueType, id:10167, locked:false, description:null, name:Task]. Error line: Script334.groovy:33

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      I actually found a solution for this. You can link the issue by the issue type's ID. That works.


      def statusMapping = [
        
          // Zendesk ticket type <-> Jira issue type
            "bug" : "10167",
            "feature_request" : "10165",
            "task" : "10166",
            "technical_issue" : "10166"
      ]
      
      /*
      Issue type IDs for PCO
      Bug = 10167
      Story = 10165
      Task = 10166
      */
      def TicketTypeName = replica.customFields."Ticket type"?.value?.value
      def TicketType    = statusMapping[TicketTypeName] ?: "10167"
      issue.type.id = TicketType
        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi!

        Actually we are limited here by the Jira Cloud rest API which doesn't allow to move issues. There is an Atlassian feature request:

        https://jira.atlassian.com/browse/JRACLOUD-70305?error=login_required&error_description=Login+required&state=a3ffdee2-9aed-4b60-bb18-d3de8ace6bce


        Still I have seen it's possible to move to other types with the script you are using, but only if the issue types shared the same workflow.


        Best regards,

        Juan

          CommentAdd your comment...