Hello all,
We're currently reviewing our Jira Service Desk setup and we would like to have all of our tickets to be approved by software or business application owners.
For this, we would create an object (for each application) in Insight and add custom fields to the objects (programmer and approver).
After creation of a ticket, we would like to use a scriptrunner script as post function, where we get the approver and programmer from the insight object, based on the chosen software in the ticket.
I've found some code on the internet, but it doesn't work in our environment...
This is what i had found:
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade")
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass)
def cfManager = ComponentAccessor.getCustomFieldManager()
CustomField Benutzername = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(11003) // ID von Customfield "Anfrage für"
def myValue = Benutzername.getValue(issue)
def myObjectBean = myValue[0]
def myAttrValue = objectFacade.loadObjectAttributeBean(myObjectBean.getId(), 1293).getObjectAttributeValueBeans()[0]; // ID von Attribute "Benutzername AD" vom Object Person
def myString = myAttrValue.getValue()
Unfortunately, the first line of code already produces an error
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade")
if i change it to
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().loaddClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade")
then this error is gone, but the next error appears on:
def myObjectBean = myValue[0]
Here i get:
[Static type checking]- Cannot find matching method
java.lang.Object#getAt(int). Please check if the declared type is correct and if the method exists.
Possible solutins: getAt(java.lang.String), putAt(java.lang.String, java.lang.Object), wait(), grep(), tap(groovy.lang.Closure), getClass() @ line 45, column 21.
Any help would be much appriciated!
Our current version are:
- Scriptrunner 6.3.0
- Insight 6.4.11
- Jira Server 7.11.2