Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

return some CustomerOrganization

Marzi Goodarzian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 19, 2021

Hi

I wrote script that should return all organizations with their users in any Service desk project,but this script return 50 organization in any project:

ArrayList<CustomerOrganization> getAllOrganizationInProject (Project pr)
{
def serviceDeskManager = ComponentAccessor.getOSGiComponentInstanceOfType(ServiceDeskManager)
def organizationService = ComponentAccessor.getOSGiComponentInstanceOfType(OrganizationService)
ApplicationUser jiraAutamticOperationUser = ComponentAccessor.userManager.getUserByName("JiraAutomaticOperation") as ApplicationUser;
ArrayList<CustomerOrganization> customerOrganization = new ArrayList<CustomerOrganization>();
def serviceDeskProjectResult = serviceDeskManager.getServiceDeskForProject(pr);
def serviceDeskId = serviceDeskProjectResult.getId();
def organizationQuery = organizationService.newOrganizationsQueryBuilder().serviceDeskId(serviceDeskId).build()

def organizationsResult = organizationService.getOrganizations(jiraAutamticOperationUser,organizationQuery)
/* PagedResponse<CustomerOrganization> organizations1 =
(PagedResponse<CustomerOrganization>)organizationsResult.getResults()
organizations1.each { a-> log.error "organizations1= "+ a.getName() }
*/
organizationsResult.getResults().each {
organization -> customerOrganization.add(organization);
}
customerOrganization.each { c-> log.error "customerOrganization= "+ c.name }
return customerOrganization

 

How do I fix it?

I want all organizations (in all page) of any service desk project.

thanks

1 answer

1 accepted

0 votes
Answer accepted
Angélica Luz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 20, 2021

Hello @Marzi Goodarzian,

Thank you for reaching out to Atlassian Community!

When using the API to get Organizations, it won’t return more than 50 results, but you can use pagination for that.

 Screen Shot 2021-09-20 at 15.08.01.png

Hope this helps!

Kind regards,
Angélica

Marzi Goodarzian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 21, 2021

Hi @Angélica Luz 

I overrided this function(OrganizationsQuery) and solved my problems.

thanks

Like Angélica Luz likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events