solidify / jira-azuredevops-migrator

Tool to migrate work items from Atlassian Jira to Microsoft Azure DevOps/VSTS/TFS.
MIT License
262 stars 222 forks source link

Need help mapping Jira custom email fields into ADO #823

Closed AnthonyRobinson closed 11 months ago

AnthonyRobinson commented 1 year ago

I need to map Jira custom fields with sub-email addresses into ADO WIs email fields. I have read the FAQ, but can't seem to generalize it to my problem.

I'm using v3.0.139

In Jira, my custom field looks like this:

"customfield_10012": {
    "self": "https://jira.myorg.com/rest/api/2/user?username=databaseadmins",
    "name": "databaseadmins",
    "key": "databaseadmins",
    "emailAddress": "DatabaseServices@myorg.com",
    "avatarUrls": {
        "48x48": "https://jira.myorg.com/secure/useravatar?avatarId=10232",
        "24x24": "https://jira.myorg.com/secure/useravatar?size=small&avatarId=10232",
        "16x16": "https://jira.myorg.com/secure/useravatar?size=xsmall&avatarId=10232",
        "32x32": "https://jira.myorg.com/secure/useravatar?size=medium&avatarId=10232"
    },
    "displayName": "Database Admins",
    "active": true,
    "timeZone": "America/Los_Angeles"
},

And my target ADO WI field needs to look like this:

"Custom.DBA": {
    "displayName": "databaseadmins",
    "url": "https://spsprodcus1.vssps.visualstudio.com/guid/_apis/Identities/guid",
    "_links": {
        "avatar": {
            "href": "https://dev.azure.com/myorg/_apis/GraphProfile/MemberAvatars/aad.reallylongstring"
        }
    },
    "id": "524189c0-5085-6c3c-b784-922a01ca2d5d",
    "uniqueName": "DatabaseServices@myorg.com",
    "imageUrl": "https://dev.azure.com/myorg/_apis/GraphProfile/MemberAvatars/aad.reallylongstring",
    "descriptor": "aad.reallylongstring"
},

My (non-working) mapping in config.json looks like this:

{
    "source": "customfield_10012",
    "target": "'Custom.DBA'.uniqueName",
    "source-type": "emailAddress",
    "mapper": "MapUser"
},

I've tried quoting and un-quoting Custom.DBA.uniqueName in the config file, but no change.

Alexander-Hjelm commented 1 year ago

If you just need to map the value of the email address, I would try omitting the source-type and mapper in order to map the raw value. Perhaps try that?

AnthonyRobinson commented 1 year ago

Nope. Removing source-type and/or mapper has no effect. I am having no problems mapping simple "key":"value" Jira custom fields. I'm just having issues with more complex, nested custom fields.

Alexander-Hjelm commented 1 year ago

I see that you would need a mapper that accesses the emailAddress property of the customfield_10012 field then? Could that be correct?

Writing your own mappers is relatively straight forward. Until then we should think of finding a general solution to this problem in the form of a mapper where you can specify the name of the property that you want to access. I will create a feature request for this so that we can track it.

Alexander-Hjelm commented 1 year ago

Writing your own mapper is relatively straightforward, if you wish to have a crack at it yourself! Simply add a new case to the switch at https://github.com/solidify/jira-azuredevops-migrator/blob/master/src/WorkItemMigrator/JiraExport/JiraMapper.cs#L87C27-L87C27, and write your own logic

github-actions[bot] commented 11 months ago

This issue is stale because it has been open for 25 days with no activity.

github-actions[bot] commented 11 months ago

This issue was closed because it has been inactive for 5 days since being marked as stale.