Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Help with Service Desk Approval API

Paul Stallworth
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 19, 2018

I'm trying to use APIs in com.atlassian.servicedesk to check which user approved a workflow approval and transition the issue to another status in certain cases.  

I'm trying to write a script to get at the approvals of an issue and I'm running into:

2018-01-19 15:06:00,895 WARN [common.UserScriptEndpoint]: Script console script failed: java.lang.Exception: Can't find plugin module or OSGi service for class: com.atlassian.servicedesk.api.approval.Approval, check the plugin is installed / enabled / licensed. at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.getPluginComponent(ScriptRunnerImpl.groovy:336) 
at com.onresolve.scriptrunner.runner.ScriptRunnerImpl$getPluginComponent.call(Unknown Source)
at approvalQuery.run(approvalQuery.groovy:26)

 

I've seen the Adaptavist support ticket about @PluginModule not working right now, and I thought I'd worked around that.  Some bits from the script:

import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.atlassian.servicedesk.api.approval.ApprovalQuery
import com.atlassian.servicedesk.api.approval.ApprovalService
import com.atlassian.servicedesk.api.approval.Approval

@WithPlugin ("com.atlassian.servicedesk")

//This next is line 26 referenced in error
Approval approval = ScriptRunnerImpl.getPluginComponent(Approval)
ApprovalQuery query = ScriptRunnerImpl.getPluginComponent(ApprovalQuery)

Am I missing something obvious?  

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Marcin Pelzner October 17, 2018

I dont know if that helps, but you can try switching to:

Class class = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.atlassian.servicedesk.api.approval.Approval")
def objectOfClass = ComponentAccessor.getOSGiComponentInstanceOfType(class)
Paul Stallworth
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 2, 2018

Hi Marcin,

Thanks for the help.  I will definitely try this the next time I'm working on it.

TAGS
AUG Leaders

Atlassian Community Events