How to map area path in AZDO incoming script from Zendesk

Originally asked by Jeff Roncone on 14 April 2023 (original question)


I do not want my ADO areapath changed at all on sync from ZD to ADO. I am ONLY SYNCING a ZD ticket to an EXISTING ADO ticket. I know that it is required, I have tried 2 different methods.

METHOD 1 :

I have tried to pull the areapath from a URL call to ADO and it is not working ( ADO incoming script )

 def remoteKey = replica.customFields."key"?.value


if(remoteKey){
    
      boolean correct = false;

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

METHOD 2 (not my preferred way)

I am trying to map a custom drop down field in Zendesk to the areapath in AZDO. ADO Incoming Script

def areaPathMap = [
    "compas_ex" : "Test-Sandbox\\compas",
    "bold_incidents" : "Test-Sandbox\\WOW Backlog",
    "test_me_aap" : "Test-Sandbox\\Bold_Intergrations_tst",
]
def targetareaPath = areaPathMap[replica.customFields."Azdo Area Path"?.value] ?: "compas_ex"
workItem.areaPath = targetareaPath

Answer by Syed Majid Hassan on 10 October 2023

Hi Jeff Roncone,

I tried to reproduce the issue but without success unfortunately.

I have pre-existing issues on Zendesk and ADO (with an AreaPath already set), and I used the CONNECT operation.

My script has no lines that are touching the AreaPath.
The result was as per my expectation i.e. the AreaPath did not change!

Can you please review this video and let me know I have the reproduction steps wrong here:

AreaPath_Failed_Repro.mp4 (old community)

Also, please do share your ADO Incoming scripts for me to understand why this behavior is occurring.

Thanks

Majid