1
0
-1

Hello,

How to synchronize area path to group picker multiselect?

Regards.

  1. Harold Oconitrillo

    Hello,

    Can you please implement the below snippet?

    if (executionInstanceName == "AES_ONSITE") {
    final def areaMapping = [
          "Portal" : "Alpha"
    ]
    def remoteAreas = NEW_PORTAL.issue.areaPath.collect { areaMapping[it].toString() }?.findAll()
    if (remoteAreas) {
          def restApiGroups = remoteAreas.collect { String remoteArea ->
            def getGroup = { String group ->
                def groups = httpClient.get("/rest/api/3/groupuserpicker",
                    ["query":[group]],
                    null,
                    [:]
            )
                groups.find {it.name == group}
            }
            def group = getGroup(remoteArea)
            if (group?.name) {
                def restApiGroup = ["name":group.name]
                restApiGroup
            } else {
                null
            }
        }
        AES_ONSITE.issue.customFields."Dev Team".value = restApiGroups
    } else if (AES_ONSITE.issue.customFields."Dev Team".value != null && (!remoteAreas|| remoteAreas.empty)) {
        AES_ONSITE.issue.customFields."Dev Team".value = null // don't sync the group picker field if a local group is not found
    }
    }

    Best regards.

  2. Keynes Desir

    Hello, 


    Are there any updates on this?

CommentAdd your comment...

2 answers

  1.  
    1
    0
    -1

    Hello, 


    Any updates on this?

      CommentAdd your comment...
    1.  
      1
      0
      -1

      Hello,


      Tried it but got the following error: 


      com.exalate.domain.exception.editor.ScriptEditorException: com.exalate.admin.editor.errors.mappings.script at com.exalate.replication.services.replication.mapping.MappingService$$anonfun$1.applyOrElse(MappingService.scala:296) at com.exalate.replication.services.replication.mapping.MappingService$$anonfun$1.applyOrElse(MappingService.scala:278) at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:38) at scala.util.Failure.recoverWith(Try.scala:236) at com.exalate.replication.services.replication.mapping.MappingService.executeInScriptRule(MappingService.scala:278) at com.exalate.replication.services.replication.mapping.MappingService.$anonfun$receive$8(MappingService.scala:183) at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307) at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:56) at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:93) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85) at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:93) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:48) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) Caused by: com.exalate.api.exception.script.ScriptException: No signature of method: services.replication.PreparedHttpClient.get() is applicable for argument types: (String, LinkedHashMap, null, LinkedHashMap) values: [/rest/api/3/groupuserpicker, [query:[null]], null, [:]] Possible solutions: grep(), get(java.lang.String), get(java.lang.String, java.util.Map), wait(), LOG(), exC() at com.exalate.error.services.ScriptExceptionCategoryService.categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions(ScriptExceptionCategoryService.scala:40) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:57) at com.exalate.replication.services.replication.mapping.MappingService.$anonfun$executeInScriptRule$1(MappingService.scala:274) at scala.util.Try$.apply(Try.scala:213) at com.exalate.replication.services.replication.mapping.MappingService.executeInScriptRule(MappingService.scala:271) ... 16 more Caused by: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: services.replication.PreparedHttpClient.get() is applicable for argument types: (String, LinkedHashMap, null, LinkedHashMap) values: [/rest/api/3/groupuserpicker, [query:[null]], null, [:]] Possible solutions: grep(), get(java.lang.String), get(java.lang.String, java.util.Map), wait(), LOG(), exC() at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158) at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) at com.exalate.processor.ExalateProcessor.execute(ExalateProcessor.java:98) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:55) ... 19 more Caused by: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: services.replication.PreparedHttpClient.get() is applicable for argument types: (String, LinkedHashMap, null, LinkedHashMap) values: [/rest/api/3/groupuserpicker, [query:[null]], null, [:]] Possible solutions: grep(), get(java.lang.String), get(java.lang.String, java.util.Map), wait(), LOG(), exC() at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155) ... 22 more Caused by: groovy.lang.MissingMethodException: No signature of method: services.replication.PreparedHttpClient.get() is applicable for argument types: (String, LinkedHashMap, null, LinkedHashMap) values: [/rest/api/3/groupuserpicker, [query:[null]], null, [:]] Possible solutions: grep(), get(java.lang.String), get(java.lang.String, java.util.Map), wait(), LOG(), exC() at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:70) at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:151) at Script72$_run_closure2$_closure3.doCall(Script72.groovy:27) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:37) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127) at Script72$_run_closure2.doCall(Script72.groovy:33) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041) at groovy.lang.Closure.call(Closure.java:405) at groovy.lang.Closure.call(Closure.java:421) at org.codehaus.groovy.runtime.DefaultGroovyMethods.collect(DefaultGroovyMethods.java:3574) at org.codehaus.groovy.runtime.DefaultGroovyMethods.collect(DefaultGroovyMethods.java:3559) at org.codehaus.groovy.runtime.DefaultGroovyMethods.collect(DefaultGroovyMethods.java:3659) at org.codehaus.groovy.runtime.dgm$87.invoke(Unknown Source) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:244) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127) at Script72.run(Script72.groovy:24) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317) ... 23 more

        CommentAdd your comment...