Script Runner Version 7.8.0
Table Grid Next Generation 1.13.8-jira89
I created a listener to fire on Issue.Updated to have the columns of my grid updated with the values of jira customfields when the user updates those jira customfields
Per documentation on Get GridService
PluginAccessor pluginAccessor = ComponentAccessor.getPluginAccessor()
Class apiServiceClass = pluginAccessor.getClassLoader().findClass ("com.idalko.tgng.jira.servier.api.Gridservice")
I get the error when using .findClass (cannot find mathing method java.lang.Object#call(java.lang.string)
if I use -Class apiServiceClass = pluginAccessor.getClassLoader().loadClass("com.idalko.tgng.jira.servier.api.Gridservice" ("com.idalko.tgng.jira.server.api.Gridservice") the error goes away
This is the same behavior for get GridRow Class I get the error if I use .findClass
Class gridRowClass = pluginAccessor.getClassLoader().loadClass("com.idalko.tgng.jira.servier.api.Gridservice" ("com.idalko.tgng.jira.servrt.api.GridRow")
So When I am defining Read field Data
def fieldData = gridService.readFieldData (readFieldData is not available?)
How do I fix this?
Also the example I reviewed is getting the field data for a specific issue, I need to get the issue Id for each issue
Below is how I am getting the issue id
def issue = event.getIssue()
IssueManager issueManager = getOSGiComponentInstanceofType(ustomfieldManager.class)
Long issueID = issue.getId()
I tried using
IssueManager issueManager = getOSGiComponentInstanceofType(ustomfieldManager.class)
Issue issue = issueManager.getIssueObject()
Long issueID = issue.getId()
it doesn't like Issue issue = issueManager.getIssueObject()
What is the correct way to get the issue ID for a listener that is accessing and updating Table Grid Data
Is using Update Rows the correct code to update a column from a Jira Customfield?
From your description, it appears you are trying to invoke APIs from other third-party libraries.
Have you tried using the @WithPlugin and @PluginModule annotations as shown in this ScriptRunner Documentation?
These annotations will help you to bypass the pluginAccessor.getClassLoader().loadClass class invocation step.
To invoke the class from the idalko package, you will need to use:-
import com.idalko.tgng.jira.servier.api.*
@WithPlugin ("com.idalko.tgng.jira.servier.api")
@PluginModule
GridService gridService
@PluginModule
GridRow gridRow
Once you have made this declaration, you can invoke the methods using the gridService and gridRow object references, respectively.
Also, why are you using this approach:
IssueManager issueManager = getOSGiComponentInstanceofType(ustomfieldManager.class)
to invoke the IssueManager?
Firstly, there is no class called ustomfieldManager.class. This is a typo error which will result in a compilation error. It is the CustomFieldManager, which is unrelated to the Issue Manager.
To invoke the IssueManager, you just have to ComponentAccessor as shown below:-
import com.atlassian.jira.component.ComponentAccessor
...
...
...
def issueManager = ComponentAccessor.issueManager
And, to invoke the CustomFieldManager object, you need to use:
import com.atlassian.jira.ComponentAccessor
...
...
...
def customFieldManager = ComponentAccessor.customFieldManager
I hope this helps to answer your question. :-)
Thank you and Kind regards,
Ram
Thank You for responding
I am getting a compile error using
//Grid Service
@WithPlugin (com.idalko.tgng.jira.server.api")
@PluginModule
GridService gridService
@PluginModule
GridRow gridRow
I am importing the com.idalko.tgng.jira.server.api.*
The error is : General error during conversion com.idalko.tgng.jira.server.api was not installed/enabled
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I ran a quick test in my environment and installed the latest release of the Idalko Table Grid Next Generation, and it appears there is a difference in the app key.
So when invoking the iDalko plugin via ScriptRunners @WithPlugin annotation, it needs to be invoked as
@WithPlugin (value = 'tge.cloud')
To identify what is the correct value that should be used for the @WithPlugin annotation, go to the plugin and locate the App key as shown in the screenshot below:-
The screenshot above shows that the App key used by the Table Grid Next Generation plugin is tge.cloud.
Below is the sample code that I have tested with:-
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.idalko.tgng.jira.server.api.GridService
@WithPlugin(value = 'tge.cloud')
@PluginModule
GridService gridService
def loggedInUser = Users.loggedInUser
gridService.addRows(2, 2, loggedInUser, [])
Please note that the sample code above is not 100% exact to your environment. Hence, you will need to make the required modifications.
Below is a screenshot of the configuration:-
I hope this helps to answer your question. :-)
Thank you and Kind regards,
Ram
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.