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
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.
Hope this helps!
Kind regards,
Angélica
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.