Hi,
I am trying to pass enum to function, but it stil raises errors:
import com.atlassian.jira.component.ComponentAccessor def plugin = ComponentAccessor.getPluginAccessor().getPlugin('com.almworks.jira.structure') // Get structure with ID 119 def syncManager = plugin.getModuleDescriptor('sync-manager').getModule() syncManager.resync(114, SyncDirection.INBOUND, false)
I mean SyncDirection.INBOUND here, API where I found it is available here: http://almworks.com/structure/javadoc/latest/com/almworks/jira/structure/api/sync/SyncDirection.html
It still raises me:
groovy.lang.MissingPropertyException: No such property: SyncDirection for class: Script1 at Script1.run(Script1.groovy:6)
Hm.. Maybe import will resolve the problem?
import com.almworks.jira.structure.api.sync.SyncDirection;
Yes, you will need the import, and @WithPlugin (https://scriptrunner.adaptavist.com/latest/jira/scripting-other-plugins.html#__withplugin) so the classloader can find it. I think it would be better to use @PluginModule (same page) rather than your method.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried it too, also with @WithPlugin it raises:
unable to resolve class com.almworks.jira.structure.api.sync.SyncDirection
with code:
import com.atlassian.jira.component.ComponentAccessor import com.onresolve.scriptrunner.runner.customisers.WithPlugin import com.almworks.jira.structure.api.sync.SyncDirection //blah blah blah
also when I use just import com.almworks.jira.structure.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you put the right param for WithPlugin? See https://scriptrunner.adaptavist.com/latest/jira/scripting-other-plugins.html#_example. Please paste the full script that doesn't work, the blah blah is the important bit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's it:
import com.atlassian.jira.component.ComponentAccessor import com.onresolve.scriptrunner.runner.customisers.PluginModule import com.onresolve.scriptrunner.runner.customisers.WithPlugin import com.almworks.jira.structure.api.sync import com.almworks.jira.structure.api.sync.SyncDirection @WithPlugin("com.almworks.jira.structure") @PluginModule StructureSyncManager syncManager syncManager.resync(114, SyncDirection.INBOUND, false)
I'd like to run one direction sync.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's missing imports, this works for me:
import com.atlassian.jira.component.ComponentAccessor import com.onresolve.scriptrunner.runner.customisers.PluginModule import com.onresolve.scriptrunner.runner.customisers.WithPlugin import com.almworks.jira.structure.api.sync.SyncDirection import com.almworks.jira.structure.api.sync.StructureSyncManager @WithPlugin("com.almworks.jira.structure") @PluginModule StructureSyncManager syncManager syncManager.resync(114L, SyncDirection.INBOUND, false)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, thanks, that helped! Is it possible to run this code periodically? Every 5 minutes or something?
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.