How to move CRM companies to Jira Service Desk Cloud organizations
In case you are migrating to Jira Cloud and CRM for Jira Cloud doesn't suit your needs for any reason, here are the steps to migrate your CRM information to Jira Service Desk Cloud.
You will need to write a script to migrate the following two directories information:
- CRM Contacts
- CRM Companies
You will need to get the token of Jira Admin to use the API calls:
- https://confluence.atlassian.com/cloud/api-tokens-938839638.html
- https://id.atlassian.com/manage-profile/security/api-tokens
Steps
Save the CRM info
Export CRM Contacts to CSV, then import the information to the Excel file and delete the unnecessary data leaving only:
- user email
- organization name
Save the file in the format your script will work with.
Get the list of Jira Cloud projects
curl --user USER:TOKEN --url "https://JIRA_ADDRESS/rest/api/3/project" --header "Accept: application/json" --header "Content-Type: application/json"
Find projects' "id" values.
Create organizations in Jira Cloud
- Use a script to read a file line by line to get companies' names
Create an organization for all the new names:
curl --user USER:TOKEN --request POST --url "https://JIRA_ADDRESS/rest/servicedeskapi/organization" --header "Accept: application/json" --header "Content-Type: application/json" --data "{ \"name\": \"ORG_NAME\"}"
You will get JSON like the following:{"id":"5","name":"My Company","_links":{"self":"https://JIRA_ADDRESS/rest/servicedeskapi/organization/5"}}
CODE
Add the organization to the Service Desk Projects
Use the organization id from the previous step.
curl --user USER:TOKEN --request POST --url "https://JIRA_ADDRESS/rest/servicedeskapi/servicedesk/projectId:PROJECT_ID/organization" --header "Accept: application/json" --header "Content-Type: application/json" --data "{ \"organizationId\": 5}"
Get user IDs and account IDs of contacts
- Use a script to read a file line by line to get contact emails
- Get user account ids using the contact email address:
curl --user USER:TOKEN --url "https://JIRA_ADDRESS/rest/api/3/user/search?query=USER_EMAIL" --header "Accept: application/json" --header "Content-Type: application/json" - Add a user to the organization:
curl --user USER:TOKEN --request POST --url "https://JIRA_ADDRESS/rest/servicedeskapi/organization/5/user" --header "Accept: application/json" --header "Content-Type: application/json" --data "{ \"accountIds\": [ \"ACCOUNT_ID\" ]}"