Forums

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

How to extract the organizations to which a customer belongs to

Peter Shields February 23, 2018

I am trying to create an issue filter where I can easily see which organizations have created new issues in the last week.  I can easily create an issue filter which shows me all issues created in the last week, but I am not able to display a column which shows the organization(s) to which the reporter belongs to.  This seems to be due to the issue not containing a field which can be listed.

I am aware of the "organizations" field, but this is not what I need; this field reports the organizations which the reporter chose to share the issue with (and if the reporter chose "private" then this field will be empty).

So I was thinking that I could create a custom field for the issue and then run some automation which would copy the organization(s) to which the reporter belongs to into this custom field.

I can foresee a problem in that any customer can belong to more than one company, which is useful if you want to allow your customers to share issues by department within an organization for example (by adding the same customer to multiple organizations which are the different departments in the same company).  The problem would then be choosing which of the multiple companies to select.  I would hope that a "left-index" into the array would suffice, or if I only allowed each customer to belong to one company, then it would only be possible to report one result anyway (which I am happy to live with as this feature is more important to me than having customers belong to multiple companies).

So does anyone know how to extract the organization to which a reporter belongs to so that I can add an automation to put the result of the query into a custom field which can be used as a column in my issue search results?

5 answers

2 accepted

1 vote
Answer accepted
Susan Hauth _Jira Queen_
Community Champion
February 23, 2018

Hi Pete,

Yes, it seems to be a missing feature.

I did find this:  JSDSERVER-4903

Which I think is the crux of the problem....

Susan

Peter Shields February 23, 2018

Well spotted - good to see I am not alone :)

0 votes
Answer accepted
Peter Shields March 6, 2018

I have discovered a work-around using an add-on.

Since we do not allow public sign-up, all customers (individual contacts) are added manually which means that we can ensure that a "property" is added to each customer called "company".

Using the add-on "Workflow Powerbox", I can add a post-function to a workflow transition which will copy the property belonging to the reporter, into a custom field belonging to the issue.  The post-fuinction enabled by the add-on is "Set Issue Field Value From User Property".  I add this post-function to the "create" transition so that the issue field is set whenever a new issue is created.

4 votes
David
Contributor
April 7, 2021

If you have ScriptRunner you can use some variation of this:

 

import com.atlassian.servicedesk.api.organization.OrganizationsQuery
//import com.atlassian.jira.user.ApplicationUser
import com.atlassian.servicedesk.api.organization.OrganizationService import com.atlassian.jira.component.ComponentAccessor import com.onresolve.scriptrunner.runner.customisers.PluginModule @PluginModule OrganizationService organizationService def user = ComponentAccessor.getUserManager().getUserByName("someuser") OrganizationsQuery organizationsQuery = organizationService.newOrganizationsQueryBuilder().build() organizationService.getOrganizations(user, organizationsQuery).getResults()
Nairi salma May 18, 2021

hi

i used this script , it's working fine but i want to extract id or name

Javidan Amiraliyev January 19, 2024

@Nairi salma you can use Stream API to map the returnted list to a list of organization names (or ids).

organizationService.getOrganizations(user, organizationsQuery).getResults().stream().map((org)->org.getName()).toList()
0 votes
WasimBuden
Contributor
April 30, 2020

I have added a custom field called 'Domain Name' and every time a ticket is opened this field is updated and anything which is xyz.com which is our domain excluded reset everything else is a customer ticket.

0 votes
Susan Hauth _Jira Queen_
Community Champion
February 23, 2018

Hi,

Via jql, I'm not sure this is possible.  You can use this jql "reporter in organizationMembers("")" to find out all the users who are members of specified organizations, but that still isn't giving you quite what you want.

Otherwise the Customers view by project does show open and closed by Organization. 

Hope that helps

Susan

Peter Shields February 23, 2018

Hi Susan,

Thanks for your suggestions - I was already aware of "report in organizationMembers()" but that is the inverse of what I want.

The "customers view" shows that Jira is able to extract the information itself, but it seems that Atlassian has not opened up this capability in JQL.

Maybe I will need to request an enhancement to Atlassian as IMHO this is basic functionality needed by companies using JSD as a business-to-business support portal.

Cheers,

Pete

Like Mark Hostetler likes this

Suggest an answer

Log in or Sign up to answer