Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Cannot view the customers grouped in organization

Purvi Turakhia April 12, 2023

Existing Service Desk project has customer emails stored organiszation wise.

Had to transfer some tickets to a new project created mimicking the old.

I cannot see the organisation for that customer under the 'Organization' field. It does not populate when I open the ticket and try to add the Organization 

However when I 'Add Organization' under Customers, it does populate and I have to manually add the Organization. It will then show up on the ticket as well

Is there a way to copy all the Organization from the old project to the new all at once?

Any help is appreciated

1 answer

1 accepted

4 votes
Answer accepted
Brant Schroeder
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 12, 2023

@Purvi Turakhia 

There is no delivered way to do this other than using the API to get the orgs and add them through the API.  https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-organization/#api-rest-servicedeskapi-servicedesk-servicedeskid-organization-get 

Otherwise, you would need to manually add them one at a time.

Frederic Wolf April 12, 2023

Hi @Purvi Turakhia 

I think @Brant Schroeder is right. I have just worked with the API to export all organizations and customers.

the next step to import them isnt far away. I recommend you to use postman to test the api calls and from postman you can create your preferred code for the request.

In my case that is powershell.

Just to let you now upfront: you have to get the organizations first and then get the customers in this organization. 

you cant get all customers with linked organizations in one call.

Additionally if you have a huge amount of organizations and/or customers you have to deal with paging as well.

if you need any further help with creating this API script I am happy to help. Just let me know. 

if not, then every community member is happy to see your solution. 😉

Like Purvi Turakhia likes this
Purvi Turakhia April 13, 2023

Thank You @Brant Schroeder @Frederic Wolf :)

This was really helpful. I will try using the API. It will be a good exercise! 

Like Brant Schroeder likes this
Frederic Wolf April 13, 2023

Hi @Purvi Turakhia 

i Just found the Powershell scripts from few days AGO for getting all organizations and all customers within the organizations.

You just have to change the first 3 Lines and Run it.

You get 2 CSV Files: organizations.csv AND CustomerList.csv

CustomerList.csv contains ALL Customers, including the information of the related organization.

[string]$YOURTOKEN = ""
[string]$YOURSITE = ""
[string]$SERVICEDESKID = "" # NOT the projectKey. Easiest way to get the ID is by opening your JSM Portal. The INT is the ID.


# Creating the Header wih Auth Token
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Basic $YOURTOKEN")
$headers.Add("X-ExperimentalApi", "opt-in")


# Getting ALL Organizations
$CompleteResponse = @()
$start = 0

do {
$response = Invoke-RestMethod "https://$YOURSITE.atlassian.net/rest/servicedeskapi/organization?X-ExperimentalApi=opt-in&limit=50&start=$start" -Method 'GET' -Headers $headers
$CompleteResponse += $response
$start = $response.size + 1
} while ($response.isLastPage -eq $false)

$Organizations = $CompleteResponse.values

# Exportingg ALL Organizations
$Organizations | select id, name | export-csv -Path organizations.csv -Delimiter ';' -Encoding Default -NoTypeInformation


# Getting ALL Customers in Organizations
$CompleteResponse = @()


foreach ($Org in $Organizations) {

$organizationID = $Org.id
$organizationName = $Org.name
$start = 0

do {
$response = Invoke-RestMethod "https://$YOURSITE.atlassian.net/rest/servicedeskapi/organization/$organizationID/user?limit=100&start=$start" -Method 'GET' -Headers $headers
$response.values | Add-Member -MemberType NoteProperty -Name organizationID -Value $organizationID
$response.values | Add-Member -MemberType NoteProperty -Name organizationName -Value $organizationName
$CompleteResponse += $response
$start = $response.size + 1
} while ($response.isLastPage -eq $false)

}

# Getting ALL Customers which are Not in a Organization
$response = Invoke-RestMethod "https://$YOURSITE.atlassian.net/rest/servicedeskapi/servicedesk/$SERVICEDESKID/customer" -Method 'GET' -Headers $headers
$response.values | Add-Member -MemberType NoteProperty -Name organizationID -Value $null
$response.values | Add-Member -MemberType NoteProperty -Name organizationName -Value $null

$CompleteResponse += $response

$CompleteResponse.values | Export-csv -Delimiter ';' -Path CustomerList.csv -Encoding Default -NoTypeInformation

$CompleteResponse.values.Count

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events