Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Create ADO-ID-to-TP-URL
  • Loading branch information
nadiab authored Sep 26, 2023
commit 6c8473c11529cc337acc76624c122942cc268929
55 changes: 55 additions & 0 deletions ADO JS Mappings/ADO-ID-to-TP-URL
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Mapping of TP URL CF to ADO ID


From TP to ADO

```
const workSharingService = context.getService('workSharing/v2')
const jiraTool = args.sourceTool;
const tpTool = args.targetTool.id
const jiraApi = workSharingService.getProxy(jiraTool);
const issueId = args.sourceEntity.sourceId;
const fieldId = args.sourceField.id;

//put Azure DevOps Organization here:
const azureOrganizationName = 'ADO_ORGANIZATION_FROM_PROFILE'

await jiraApi.postAsync(`api/v1/${args.sourceEntity.entityType}/${args.sourceEntity.sourceId}`, {
headers: {
'Content-Type': 'application/json'
},
body: {
[fieldId]: {
label: `${args.targetEntity.sourceId}`,
url: `https://dev.azure.com/${azureOrganizationName}/_workitems/edit/${args.targetEntity.sourceId}`
}
}
})
```


ADO >> TP

```
const azureOrganizationName = 'ADO_ORGANIZATION_FROM_PROFILE'

return {
kind: 'Value',
value: {
label:`${args.sourceEntity.sourceId}`,
url:`https://dev.azure.com/${azureOrganizationName}/_workitems/edit/${args.sourceEntity.sourceId}`
}
}
```


COMPARATOR

```
const {sourceFieldValue, targetFieldValue} = args;
// const url = sourceFieldValue.toolValue && sourceFieldValue.toolValue.URL;
// return (url && url.split('/').pop()) === (targetFieldValue.toolValue && targetFieldValue.toolValue.toString())

const url = sourceFieldValue.toolValue && sourceFieldValue.toolValue.Label;
return (url) === (targetFieldValue.toolValue && targetFieldValue.toolValue.toString())
```