When a service desk agent creates a ticket, organization is not automatically added.
Is it possible to add this with the automation plugin or with scriptrunner?
Issue's created through the customer portel does auto add the organization
Hi Laurens,
So a script listener during an Issue Created event would be
import com.atlassian.fugue.Option import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.ModifiedValue import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.util.DefaultIssueChangeHolder import com.atlassian.servicedesk.api.ServiceDeskManager import com.atlassian.servicedesk.api.organization.OrganizationService import com.atlassian.servicedesk.api.organization.OrganizationsQuery import com.atlassian.servicedesk.api.util.paging.LimitedPagedRequest import com.atlassian.servicedesk.api.util.paging.LimitedPagedRequestImpl import com.onresolve.scriptrunner.runner.customisers.PluginModule import com.onresolve.scriptrunner.runner.customisers.WithPlugin @WithPlugin("com.atlassian.servicedesk") @PluginModule ServiceDeskManager serviceDeskManager @PluginModule OrganizationService organizationService MutableIssue issue = issue def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def serviceDeskProject = serviceDeskManager.getServiceDeskForProject(issue.projectObject) // if the project is not a Service Desk one then do nothing if (serviceDeskProject.isLeft()) { log.error "${serviceDeskProject?.left()?.get()}" return } def serviceDeskId = serviceDeskProject?.right()?.get()?.id as Integer // get the available organizations for that project def organizationsQuery = new OrganizationsQuery() { @Override Option<Integer> serviceDeskId() { return new Option.Some<Integer>(serviceDeskId) } @Override LimitedPagedRequest pagedRequest() { return new LimitedPagedRequestImpl(0, 50, 100) } } // get all the organizations configured for that project def organizationsToAdd = organizationService.getOrganizations(currentUser, organizationsQuery)?.right()?.get()?.results // get the Organizations custom field def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Organizations") // finally update the organizations custom field cf.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(cf), organizationsToAdd), new DefaultIssueChangeHolder())
What it actually does is if a project gets created (as you mentioned - not through the customer portal) then it will update the Organizations custom field in order to include all the Organizations configured for that project. Of course this script can be edited in order to match different criteria (if the reporter of an issue is member of any organization, etc..). The key thing in this script is the 'access' to the JIRA Service Desk API and a way to start using it.
regards, Thanos
Hi
we recently started to use Jira Service Desk, we have used another service desk appliation.
in that app, you can add domain and when case created system knows the customer through the domain and add the organization.
Why do i run a script to catch the customer to add into organization.
it should be conguriable !!
is it a way to make automation rule to catch?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thanos,
could you also write a script where the organization is added automatically when an issue is created by a customer over the customer portal?
Thanks ;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
i am getting a compile issue when calling
def serviceDeskId = serviceDeskProject?.right()?.get()?.id as Integer
[static type checking] - No such property : id for class : R
same issue for results
def organizationsToAdd = organizationService.getOrganizations(currentUser, organizationsQuery)?.right()?.get()?.results
what can cause the problem?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is the old version of Community that was wrongly escaping some symbols in a code area. I edited my answer above.
So when you see < this is the symbol < and the symbol > is wrongly encoded to >
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Thanos Batagiannis [Adaptavist]
when i run this in the console this error occurs:
The script could not be compiled: <pre>org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script27.groovy: 37: The return type of com.atlassian.fugue.Option serviceDeskId() in Script27$1 is incompatible with java.util.Optional in com.atlassian.servicedesk.api.organization.OrganizationsQuery . At [37:5] @ line 37, column 5. @Override ^ 1 error </pre>.
Cheers
Toni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am running into the same challenges with my implementation.
There is a workaround to number 4 with the Extension for JIRA Service Desk plugin which has custom fields for Organization, Request Type, and Additional Participants. The Organization custom field can be added to the Create Request screen in JIRA and you can select the customers Organization while you are creating the ticket.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Big upvote for the workaround to number 4. That's a huge use-case in our environment and just made the lives of everyone on my team much easier (and allowed me to remove some scripting that I wrote poorly)!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Clyde,
Did you get the solution for this first point?
If a customer who belongs to an organization creates a ticket via the portal, their organization will be added to the ticket unless they are members of more than on organization, then it will be a private request (Organization is null)
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found my answer to this via Dieter's answer in this thread.
Workflow post hooks. You can set the organisation on the create transition post hook. It will only let you assign one organisation for the whole workflow. For my use that was sufficient. You could create multiple differing workflows and projects per organisation...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi @Thanos Batagiannis [Adaptavist]
I have the same problem reported by @Yousaf in February 2020 . How can the ticket be automatically shared with the organization when the customer creates a ticket? Currently, the default is set to "Private request" . However, we want the default to be "Share with organization" when the customer is setup in JSD as part of an organization. If the customer is not setup under an organization, then it makes sense to have the default as "Private request". Look forward to your comment. Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you find an answer @Thanos Batagiannis [Adaptavist] ?
We are struggling to ideally remove the private request as it is not relevant for us, or failing this automatically add that individual users Organization to the issue as it is created / saved. Doesn't seem a huge ask but makes such different for people when agents have to manually go in and try to identify the organisation someone belongs to and then edit the ticket to add this. Does anyone have any suggestions on how to achieve the above?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This response may be a bit late, hopefully you have already found the answer by now but just in case please see below.
Admins can change the default Organization sharing behaviour by going to Settings > Products > Configuration (under Jira Service Management), within the "Organization management" section.
Should new requests automatically be shared with a customer's organization?
Change setting to yes, this will then automatically share with the organisation when ticket is created.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In response to your question about a solution for the Cloud Version...I have a workaround that works for us...my workflow is set up as follows:
1. I have created a group called "DSG" and all the service desk agents belonging to the DSG Organization belongs to this group. I did not create an organization for DSG, specifically because I need to manually control access of this group.
I unfortunately do not have a working solution for the case where you would prefer to let users automatically become part of an organization based on their domain (instead of manually managing a group).
2. On the Project where they will act as service desk agents, Under people - I have a added the Group, "DSG". I have granted the correct level for the Service desk Agent role.
3. The Workflow requires the Add-On JMWE "Jira Miscellaneous workflow extensions"
Refer to the screenshot below on the Add organization step specifically.This is done during the initial Create Issue Step, added as a Post Function.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for help. Unfortunately, this is not what i need.
Problem is, when agent create issue (phone call with customer) we want one single operation: create issue, set description, spent time and organisation and close issue.
One form, one action.
Current Jira capabilities require tocreate issue, and edit it after, to set organisation.
Your solution allows to set only one predefined organisation, but we need to choose from list of all currently existed organisations.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found a way of adding an organization to any issue created by using the Jira Miscellaneous Workflow Extensions Add On - we use a Jira Cloud Instance by the way...On the "Create" Step of the workflow, Update the issue field "Organizations" with JMWE.
I am very conscious of the plugin costs on our site, and always try to make do with what we have...Thankfully this time there was another alternative... ;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please, can you be more specific? I am new in this area and unfortunately can not reproduce your solution.
I installed JMWE, but unable to "Update the issue field "Organizations" with JMWE."
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Laurens,
In your original question you wrote "Issue's created through the customer portel does auto add the organization".
Did you mean to say does NOT or are you getting this to work with another solution or script?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not sure how i did it then, but now you can just add an automation rule with the automation plugin and add it like that.
I still use this script to add it to all projects but automation is a bit more user friendly :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Laurens Coppens ,
Please could you detail how you were able to achieve this as we have a similar issue and can't find 'organisation' in the automation rule field list.
Regards,
Nick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nicholas Fish You need to use the automation plugin by codebarrel, not the default build in automation of service desk.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry to ask but has anyone found a way to use the scriptrunner code to only grab the reporters organisations. btw i am a relative novice to scripting in JIRA.
The use case is when you create an issue on behalf of a customer like on the phone so the reporter is an external customer and generally an email address. that email address is the "account" and is a part of an organization to logically group our customers.
So when i create the issue i only want the organisation the reporter is a member of added not all the organizations like the code achieves .
Ive tried modify the currentUser to be issue.getReporter() and issue.getReporterUser() but cant get it to work.
Any suggestions or ideas?
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Yes. This a static check but no a real errors.
So you can run your script and it will work fine.
Ibrahim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
i am getting a compile issue when calling
def serviceDeskId = serviceDeskProject?.right()?.get()?.id as Integer
[static type checking] - No such property : id for class : R
same issue for results
def organizationsToAdd = organizationService.getOrganizations(currentUser, organizationsQuery)?.right()?.get()?.results
could you please help ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have the same problem. @Ibrahim TOUMI you found a solution?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You might want to check out the solution for later script runner versions:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Scroll this page lower and you will find the answer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mari,
Thanks for you respons, but i don't see how that url gives a solution to my problem.
If a servicedesk Agent creates a ticket (not through the customer portal) an organization is not automatically added.
I want to do this automatically, now my agents need to manually fill in an organization after creating a ticket.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there a way to automatically add the organization in the cloud version ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm currently running a trial of the cloud version and it seems this is still the case or am I just doing something wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've same problem. My agents can insert issue, by calling phone, so should be able to type customer name or organizzation. Is possible make this ? I tried to add organizzation to screen create issue, but it is not showed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same here.
1) we can't show the field "Organisation" in the create screen
2) 98% of the time I want the organisation to be the reporter's organisation.
If this could be done in "automation" i would be pleased
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.