Assigning organizations field based on customer that raised the query

Patricia April 3, 2019

Hello,

I'm having some issues around trying to improve the following code i have in JMWE. 

issue.fields["Reporter"] isInOrganizations ()

The idea is that the customer will report the ticket, and then the organization that they are from, will be automatically assigned based on the customer/organization setup. Now that we have tons of organization, a normal if/else check doesn't seem ideal? Just wondering if there is a better method out there?

Thank you.

2 answers

1 accepted

0 votes
Answer accepted
David Fischer
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 4, 2019

Hi Patricia,

unfortunately, Jira Service Desk doesn't expose a REST API to access the Organizations to which a Customer belongs. And iterating over each Organization to check whether the customer belongs to it is not a good idea either, as you will quickly reach your Jira Cloud REST API "quota".

I have created https://ecosystem.atlassian.net/browse/JSDECO-125 to request this feature from Atlassian, but don't hole your breath!

Patricia April 4, 2019

Thank you David. I was hoping that we would have a workaround to this. This doesn't make things easier for us unfortunately. Also thanks for the feature request!

0 votes
Gary Lee Ritchey March 17, 2022

Update: for Cloud users

I have recently been using JMWE and by accessing the service desk API and JMWE this is now possible.

 

Go to your JMWE app and select: Event-Based Actions and select new

Trigger:  issue created

Project: I have our main service desk selected

Select Add Post function

Set Target issue: Current issue

Add Field: Organizations

options: set only if empty

Value: 

{{"/rest/servicedeskapi/organization?accountId=:issue" | callJira( params={"issue":issue.fields.reporter._accountId})}}

 

Run as add on user and the save.

Save again and then it should set the organization based on the reporters account ID. 

Johannes Schwanzer July 13, 2022

Does this still work for you? I did try it today and I cannot get it to work. The Organizations Field stays empty.

Johannes Schwanzer July 13, 2022

I did find a solution:

{% set result = "/rest/servicedeskapi/organization?accountId=:issue" | callJira(params={"issue":issue.fields.reporter._accountId}) %}
{{ result.values[0].name }}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events