Unable to link new case from ZD to existing case in ADO

Originally asked by Harold Oconitrillo on 14 April 2023 (original question)


I click Exalate from ZD, it goes to in progress and then states not sync’ed. No errors, this is in our PROD sync.

This is the code I have:

if(remoteKey){
    
      boolean correct = false;

 def localWorkItem = httpClient.get("/_apis/wit/workitems/${remoteKey}?api-version=6.0", correct)
      //debug.error("${localWorkItem}")
     //if(localIssue == null) throw new com.exalate.api.exception.IssueTrackerException("Issue with key "+remoteKey+" was not found")
       
       workItem.id = localWorkItem?.id
       return;
}

Answer by Ariel Aguilar on 14 April 2023

Please update your code to the following:

if(remoteKey){
    
      boolean correct = false;

 def localWorkItem = httpClient.get("/_apis/wit/workitems/${remoteKey}?api-version=6.0", correct)
      //debug.error("${localWorkItem}")
     //if(localIssue == null) throw new com.exalate.api.exception.IssueTrackerException("Issue with key "+remoteKey+" was not found")
       workItem.id = localWorkItem?.id
       workItem.key = localWorkItem?.id
       return;
}

The line workItem.key = localWorkItem?.id is required to complete the connection.

Thanks,

Ariel