With the last Service Desk update the content of the Customer Request Type fields have changed from "desk/general-help" to "desk/e968b227-666d-45f4-867a-2f289c22318f"
I couldn´t find a way to determine the valid options for a given issue (using getOptions from the regular API just returns an empty array).
Does anyone have an idea about how to archive this? My last resort would be looking it up in the database - but there should be an easier way...
Thanks in advance
Thomas
ps: Some explaination of the usecase:
Community moderators have prevented the ability to post new answers.
Hi Thomas,
Try in your script console (using the Service Desk API)
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.servicedesk.api.portal.PortalService import com.atlassian.servicedesk.api.requesttype.RequestTypeService import com.onresolve.scriptrunner.runner.customisers.PluginModule import com.onresolve.scriptrunner.runner.customisers.WithPlugin @WithPlugin("com.atlassian.servicedesk") @PluginModule RequestTypeService requestTypeService @PluginModule PortalService portalService def serviceDeskIssueKey = "SD-1" def serviceDeskIssue = ComponentAccessor.getIssueManager().getIssueByCurrentKey(serviceDeskIssueKey) def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def requestTypes = requestTypeService.getAllRequestTypes(user) if (requestTypes.isLeft()) { log.error "${requestTypes.left().get()}" return } if (!serviceDeskIssue) return def portalRequest = portalService.getPortalForProject(user, serviceDeskIssue.projectObject) if (portalRequest.isLeft()) { log.debug "Error ${portalRequest.left().get()}" return } def portal = portalRequest.right().get() return requestTypes?.right()?.get()?.findAll {it.issueTypeId == serviceDeskIssue.issueTypeId as Long && it.portalId == portal.id}?.collect { "Request type: ${it.name} | ID: ${it.id} | Description: ${it.description}}" }?.join("<br>")
Please let me know if this does the trick.
regards, Thanos
Thanks Thanos,
that gives me a list of all (71) request types names, IDs and descriptions across all service desk projects. The valid values are not included and the right project isn´t selected, but it points me to the right direction.
What I probably want is calling validValues() on the RequestTypeField object - but at the moment I cannot find a way to get the right instance of the object
Do you have any ideas
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Thomas,
Updated the script above to take into consideration the project. Regarding the validity I am still searching (fairly new to Service Desk JAVA API) ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
when I try this I just get:
2017-07-26 07:02:42,866 WARN [common.UserScriptEndpoint]: Script console script failed: groovy.lang.MissingPropertyException: No such property: event for class: Script3 at Script3.run(Script3.groovy:10)
all (it.*) are highlighted in red on the return line
Any guidance would be appreciated
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.